Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the consequences if I remove _USRDLL preprocessor definition?

I'm a beginner! I try to use shared MFC libraries with an old dll, but when I compile it with VC6 I obtain the error "LNK2005: _DllMain@12 already defined". I found so many explanations, but only removing "_USRDLL" the issue disappear and the dll work. Now I'm a bit confused about the consequences of this action.

In addition, I read on MSDN that a USRDLL correspond to a regular DLL that statically links to MFC. So, when I create a new Win32 Dynamic-Link Library with VC6, why "_USRDLL" is already present if I choose in Project->Setting->Genaral "Use MFC in a shared dll" or "Not using MFC"? Sorry for my bad english and thank you for any help!

like image 532
Mark Avatar asked Oct 22 '22 00:10

Mark


1 Answers

A regular DLL with the MFC never has a DllMain. This is covered by the CWinApp object.

Only Extension DLLs have a DllMAin. Read TN033. _USRDLL has to be defined in this case!

like image 115
xMRi Avatar answered Oct 27 '22 10:10

xMRi