Problems building DLLs in VC++ 5.0
Posted on 1997-05-07
In Visual C++ I use the App Wizard to generate a DLL shell (with the MFC stuff not statically linked),
and add in some objects that I've pre-written, and wish to add to the library. I run Dllxprt32.exe to generate a DEF file from the compiled objects and build the DLL.
So far, so good...
I then build a test app to call into the DLL, and this works fine.
However, when I go back and try to rebuild the DLL at this point I get the following linker error...
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in
MSVCRTD.lib(dllmain.obj); second definition ignored
Creating library Debug/MfcDLL.lib and object Debug/MfcDLL.exp
Debug/MfcDLL.dll : fatal error LNK1169: one or more multiply defined
Now I'm prepared to accept that the two libraries both have a definition of DllMain(),
but how come it built the first time OK?
I need both mfcs42d.lib and msvcrtd.lib to build the DLL...
I'm using Visual C++ 5.0, with Win95
Can anyone tell me what I'm doing wrong?