Marshalling reference to an object

  • Thread starter Thread starter Steven Cool
  • Start date Start date
S

Steven Cool

Hi,

Once I wrote a dll with some methods. In that dll, there are several
classes. There is for example a Tracer class. In that Tracer class,
there is a method:

Tracer& instance();

Which returns a reference to a Tracer object.(singleton
implementation)
Now I want to use this method in C#. So I wrote a c# class which
import that method:

[DllImport("Tracer_1_0d.dll", EntryPoint="#120")][return :
MarshalAs(???)]
public static extern ??? instance();

What should I write in the place of the questionmarks?
Or am i doing something wrong (if you can tell me what, I hope so)?

regards

Steven
 
Steven,

It would be a lot easier to work with this kind of C++ API from
Managed C++, so I recommend that you do that instead and write MC++
wrapper classes that you can more easily use from C#.



Mattias
 
Back
Top