managing c++ pointer reference from c#

  • Thread starter Thread starter Deanna
  • Start date Start date
D

Deanna

I'm writing a C++ managed .dll that I will call from my C# app. The C+
+ code will need to return an object pointer to the C# that will need
to be passed back for subsequent method calls. The C# code doesn't
need to do anything with the pointer, just accept it as a return value
from the first method and then pass it to the rest.

Can anyone get me started here? I can't figure out how to type the
parameter in the C# dllimport statment and/or the c++ code.

thanks!
Deanna
 
If your writing managed C++ then you don't need to use P/Invoke, you just
reference the DLL from your C# project and use its types just as if they had
been written in C#. DllImport is for calling unmanaged code.

If you still need to pass a pointer around you'd use System.IntPtr. If you
need more help please post some sample code of what you're trying to do.

HTH
 
Back
Top