Parameter Passing from C# to C++



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.

.



Relevant Pages

  • Parameter passing from C# to C++
    ... In C#, class objects are reference types, so if an object is passed ... int result; ... This is fine until we need to run with remoting. ... class object in both directions (so the function can change members of ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Parameter Passing from C# to C++
    ... In C#, class objects are reference types, so if an object is passed ... This is fine until we need to run with remoting. ... class object in both directions (so the function can change members of ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: .NET Remoting/Serialization way too slow vs C++ binary/tcp
    ... Remoting is different from just shooting the contents of a class over ... > int port = 7627; ... > BinaryFormatter bF = new BinaryFormatter; ... > serialization involved - just send the byte stream of the class via ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How do I upload files using remoting?
    ... How do I upload files using remoting? ... One way to do this is to have a method on the server like: ... int Write ... The .net framework help has a remoting sample that would be a good ...
    (microsoft.public.dotnet.languages.csharp)