Mixed Mode DLL Issue (Need Help now!!)

P

Paul Brun

Hello everyone,

I have tried all the solutions trying to figure out how to remedy my mixed mode DLL solution,
however, I still can't get the project to compile. I have tried all the solutions managed in the
Microsoft Knowledgebase article, but I get the following issues:

libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj
libcmt.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter already defined in msvcrt.lib(MSVCR71.dll)
libcmt.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in msvcrt.lib(MSVCR71.dll)
libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup

D:\Mitel-Development\MiTAI.NET\MitaiNET\Release\MitaiNET.dll : fatal error LNK1120: 1 unresolved externals

And my original issue involving the last line "unresolved external symbol _main...bla..." is still causing me problems.

Any hints.

Thanks

Paul
 
G

Guest

I have tried all the solutions trying to figure out how to remedy my mixed
mode DLL solution,
however, I still can't get the project to compile. I have tried all the solutions managed in the
Microsoft Knowledgebase article, but I get the following issues:

libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
I discovered that static linking of the MFC could cause something similar
like this.
I had to recompile with MFC in DLL instead of static.
 
F

Frank Lopez

I discovered that static linking of the MFC could cause something similar
like this.
I had to recompile with MFC in DLL instead of static.

If you put your unmanaged C++ code in a pure unmanaged DLL (separate
project), a static link with MFC appears to be holding up just fine on
this side.

This approach uses the managed-to-unmanaged C++ class mappings within
a project just focused on that: a proxy layer DLL. The proxy
managed-to-unmanaged DLL does not link with MFC.
 
Joined
Aug 10, 2006
Messages
1
Reaction score
0
This is how I figured out to get a mixed mode dll compileable:
  • Properties à Configuration Properties à General à Use Managed Extensions
    Change this to “yes


  • Properties à Configuration Properties à General à Use of MFC
    Change this to “Use MFC in a Shared DLL
    Without this, you will receive error LNK2005




  • Properties à Configuration Properties à Linker à Command Line
    add “/noentry


  • Properties à Configuration Properties à C/C++ à Code Generation à Runtime Library
    change to “Multi-threaded Debug DLL(/MDd)” in Debug mode and “Multi-threaded DLL (/MD)” in Release mode.
    Otherwise you will receive a LNK2019 error.




  • I do not (!) add the __DllMainCRTStartup@12
 

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