DLLImport Decorating 
Author Message
 DLLImport Decorating

Hello,

I am trying to do a DLLImport on a DLL that was written
in MFC. It seems all of the entry points are decorated
and I cannot seem to figure out how to call them.

using dumpbin I get the following


I know Init is a function in Class HilltopMgr, but how do
I call it?

[DllImport("Hilltop.dll")]

errors!

Is there a way to build a MFC DLL without decorating?

Any help would be greatly appreciated!!!



Mon, 18 Apr 2005 00:59:47 GMT  
 DLLImport Decorating
John,

    You can not use DllImport to access classes written in MFC.  You can use
MFC in the implementation, but your declarations have to be standard
exported functions.

    If you want, you can also use Managed Extensions for C++ to wrap your
MFC classes and create a managed interface to them.

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> Hello,

> I am trying to do a DLLImport on a DLL that was written
> in MFC. It seems all of the entry points are decorated
> and I cannot seem to figure out how to call them.

> using dumpbin I get the following


> I know Init is a function in Class HilltopMgr, but how do
> I call it?

> [DllImport("Hilltop.dll")]

> errors!

> Is there a way to build a MFC DLL without decorating?

> Any help would be greatly appreciated!!!



Mon, 18 Apr 2005 01:02:30 GMT  
 DLLImport Decorating
John,

Quote:
>[DllImport("Hilltop.dll")]

>errors!

>Is there a way to build a MFC DLL without decorating?

Try it like this


CallingConvention=CallingConvention.ThisCall)]
static extern void HilltopMgr_Init(IntPtr thisptr);

Then, assuming it's an instance method, you must get a this pointer to
the class somehow. For a more complete example, see

FrameworkSDK\Samples\Technologies\Interop\PlatformInvoke\Custom\CS\ClassMethods.cs

Mattias

===

http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.



Mon, 18 Apr 2005 06:32:02 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. DLL functions exported with decorated names in a migrated VC6 project

2. VC6 decorated names

3. Decorated name length exceeded.

4. Decorated Function Names

5. Exporting decorated functions

6. VC++ STL Decorated Name Problem!

7. Exporting an imported function in decorated form

8. Decorating problems

9. Exported DLL fn decorated names

10. Decorated names in C and C++!

11. Prototype from decorated name

12. Decorated names

 

 
Powered by phpBB® Forum Software