Linking VC6 with VC7 DLL

  • Thread starter iZik via DotNetMonster.com
  • 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.
 
R

Ronald Laeremans [MSFT]

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
 
R

R. Green

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top