how to use MFC extension Dll in c#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
Icould not find any way to do that. And the following does not work.

[DllImport("myMFCExtension.dll")]
public extern MyClassInDll myClassObj;
 
Dllimport is used to declare a C style API function signature that is used
by the PInvoke layer in the CLR to:
- load the library (if not already loaded)
- marshal the arguments (and other stuff like pin, pack and align arguments)
- call the function through the PInvoke thunk.
Seems like you try to import a native C++ class, this is not possible from
C#. Your only option is to wrap the native class with a managed class using
MC++ and expose that managed class to C#.

Willy.
 
Back
Top