Unable to Load C++ DLL into C#

Jell

Member
Joined
Mar 5, 2004
Messages
10
I am facing this problem

1. I have to load a C++ DLL into my C# code.

2. The method in the DLL which i want to access is

GetNames(&strCStringArrayClass)

This method takes a pointer to the CStringArray Class Object and populates the array of strings.

If I use DllImport (pInvoke) method, how should i write the prototype for the exported method???

is there any other way of doing this?

Please Help
 
I believe u will need to use c++.net for this. I cannot think of a way to create a CStringArray object in c# to be passed to the c++ method.
 
Last edited by a moderator:
I believe if you declare the parameter as the IntPtr type, you can just pass the
method directly to the DLL and marshalling will convert the method into a pointer.
 
Back
Top