Calling c++ dll in csharp

linesh

Active member
Joined
Oct 14, 2004
Messages
32
Location
Washington D.C.
I have a native C++ (not COM) DLL that has classes in it. I would like to call it from csharp - create class objects, and invoke functions. What is the best way of approaching this. I donot have access to the source, all i have is the .h files and the dlls. I am not really very familiar with P/Invoke - is that the only option?

Thanks in advance!
Linesh
 
Unfortunately P/Invoke is about the only option and not likely to be an easy one at that. Depending on how the classes have been exported from the DLL the actual method names could have been mangled, in this case you would need to use a tool like dumpbin.exe to get the actual exported method names to call.

Depending on the situation in might be easier to create a .Net wrapper in managed C++ and call the wrapper from .Net.
 
Back
Top