Parameter Passing from C# to C++
- From: "Rich" <richard.s.wade@xxxxxxxxxxx>
- Date: 11 Jan 2007 08:56:16 -0800
I need to build a managed DLL in C++ and call it from C#. I need this
to work with remoting as well.
In C#, class objects are reference types, so if an object is passed
directly to a C++ method it is considered a reference to the object.
C# call:
i = some_method( some_object );
C++ method:
int some_method( some_class ^ some_object)
{
int result;
some_object->member1 = 123;
result = some_object->member2 * 2;
return result;
}
This is fine until we need to run with remoting. For C# to marshal the
class object in both directions (so the function can change members of
the object and pass the new value back), then in C# we must use a "ref"
call:
i = some_method( ref some_object );
How should the C++ method be written to accept this call?
Thanks - any suggestions are appreciated.
.
- Follow-Ups:
- Re: Parameter Passing from C# to C++
- From: Ben Voigt
- Re: Parameter Passing from C# to C++
- Prev by Date: C# 3.0: no additions to where clause? dang.
- Next by Date: Re: comunication between JScript and C#
- Previous by thread: C# 3.0: no additions to where clause? dang.
- Next by thread: Re: Parameter Passing from C# to C++
- Index(es):
Relevant Pages
|