Linking VC6 with VC7 DLL

  • Thread starter Thread starter iZik via DotNetMonster.com
  • Start date Start date
I

iZik via DotNetMonster.com

Is it possible to statically link an application compiled in VC6 with a managed DLL ?

I have a very large VC6 (MFC) app, which I can't convert to VC7 at the moment. I need to be able to call a managed C++ DLL with some unmanaged exported functions. If I use LoadLibrary - it works, but I really would like to have it link statically with the application. The link completes without errors but at run-time I get this error:

"The application failed to initialize properly (0xc0000005). Click on
OK to terminate application."

The error occurs before any of my code is executed - apparently when the DLL is being loaded. If I build the DLL without the /clr flag, it works. The error happens only when the DLL is managed.

Any help would be greatly appreciated.
 
No, this is not reliably possible. The startup code needs to be aware of the
CLR. The 6.0 generated code by definition is not.

Ronald Laeremans
Visual C++ team
 
If LoadLibrary works for you, I think you can use delayed loading of your
DLL to emulate static linking.


iZik via DotNetMonster.com said:
Is it possible to statically link an application compiled in VC6 with a managed DLL ?

I have a very large VC6 (MFC) app, which I can't convert to VC7 at the
moment. I need to be able to call a managed C++ DLL with some unmanaged
exported functions. If I use LoadLibrary - it works, but I really would like
to have it link statically with the application. The link completes without
errors but at run-time I get this error:
"The application failed to initialize properly (0xc0000005). Click on
OK to terminate application."

The error occurs before any of my code is executed - apparently when the
DLL is being loaded. If I build the DLL without the /clr flag, it works. The
error happens only when the DLL is managed.
 
Back
Top