Calling functions from .NET dll from Win32 C++

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Igor (bija_at_baja.com)
Date: 01/27/05


Date: Thu, 27 Jan 2005 12:22:10 +0100

I need to call functions in the .NET assembly (dll) from an unmanaged application via winAPI calls (LoadLibrary...). I've found examples on how to modify the .IL code of an assembly so I can export the methods needed, but I have a following problem :

Everything works fine when I use __stdcall calling convention from an unmanaged app, but when I switch to __cdecl managed dll loads and executes only the first time??? Subsequent calls to the function result in a fatal error???

Please, help :)

Thanx