Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

DllMain@12 already defined in LIBCMTD.lib

larryscheier
Beginner
1,304 Views
When converting a large mixed Fortran/C++ project from DVF 6.6 to Intel VFC, I get the following error during the link:
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in LIBCMTD.lib(dllmain.obj)

I believe I have followed the solution mentioned in http://support.microsoft.com/default.aspx?scid=kb;en-us;148652 but it doesn't help.

Here are the particulars:

The c++ Lib options:

/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_MBCS" /FD /EHsc /RTC1 /MTd /YX"stdafx.h" /Fp".Debug/T700Win.pch" /Fo".Debug/" /Fd".Debug/" /W3 /nologo /c /ZI /TP

The Fortran options:

/nologo /Zi /Od /include:"Debug/" /warn:declarations /iface:cvf /module:"$(INTDIR)/" /object:"$(INTDIR)/" /traceback /check:bounds /libs:static /threads /dbglibs /c

The Fortran Linker options:

/OUT:"c:cdsTrace700T700SimIntel.dll" /INCREMENTAL /NOLOGO /NODEFAULTLIB:"msvcrt.lib libcmtd.lib Nafxcwd.lib" /DEBUG /PDB:"$(OUTDIR)/T700SimIntel.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"$(OUTDIR)/T700SimIntel.lib" /DLL c: race700 racedata6x.lib c:Trace700TraceExtDLL6x.lib c: race700ViewerDll6x.lib


An example of one of the C++ routines:

#include "forcelib.h"
#include
#include

unsigned long callback_function = 0L;
_declspec ( dllexport )
void __stdcall SetCallback(long cb)
{
if (cb != 0L)
callback_function = cb;
}
void UseCallback(int pctdone, int status)
{
if (callback_function)
{
((void (__stdcall *)(int *, int *))callback_function)(&pctdone, &status);
}
}

Thanks for any insight!
Larry Scheier
0 Kudos
2 Replies
larryscheier
Beginner
1,304 Views
The error finally went away when I changed the Fortran Runtime Library setting from "Debug Multithread" to "Debug Multithread DLL"
0 Kudos
Steven_L_Intel1
Employee
1,304 Views
Interesting. Given the C++ and Fortran options you show I would not expect this, though I see that you have "gummed the works" by adding /nodefaultlib linker options. I suspect they are at least partly responsible for the problem.
0 Kudos
Reply