managing c++ pointer reference from c#

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
 
K

KH

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top