VC DLL编译参数区别

C的dll分win32 dll和MFC dll。MFC dll又分为使用共享MFC DLL的规则DLL,带静态链接MFC的规则DLL和MFC扩展DLL。
  
在工程建立以后,如何识别这些不同的DLL呢?
 
可以在工程属性 -> C++ -> 命令行看编译参数:
 
Win32 dll:
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "WIN32DLL_EXPORTS" /D "_UNICODE" /D "UNICODE" /D "_WINDLL" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"DebugWin32Dll.pch" /Fo"Debug\" /Fd"Debugvc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt
 
 
Shared Regular MFC dll:
/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_USRDLL" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /D "_AFXDLL" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"DebugShareRegularMFCDll.pch" /Fo"Debug\" /Fd"Debugvc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt
 
 
Static Regular MFC dll:
/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_USRDLL" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MTd /Yu"stdafx.h" /Fp"DebugStaticRegularMFCDll.pch" /Fo"Debug\" /Fd"Debugvc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt
 
Extend MFC dll:
/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_AFXEXT" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /D "_AFXDLL" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"DebugExtendMFCDll.pch" /Fo"Debug\" /Fd"Debugvc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt
 
 
MFC exe:
/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_AFXDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"DebugResDllTest.pch" /Fo"Debug\" /Fd"Debugvc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt
 
dll都定义有_WINDLL
共享链接到MFC DLL的都有_AFXDLL
标准C导出dll都定义有_USRDLL
 
Win32 dll:                             _WINDLL    _USRDLL    XXX_EXPORTS (XXX为DLL名称) 
Shared Regular MFC dll:        _WINDLL    _USRDLL    _AFXDLL
Static Regular MFC dll:         _WINDLL    _USRDLL
Extend MFC dll                     _WINDLL    _AFXDLL    _AFXEXT
MFC exe:                              _AFXDLL
 
使用的区别请参考MSDN:
http://msdn.microsoft.com/zh-cn/library/vstudio/30c674tx(v=vs.100).aspx
http://msdn.microsoft.com/zh-cn/library/vstudio/f22wcbea(v=vs.100).aspx
http://msdn.microsoft.com/zh-cn/library/vstudio/h5f7ck28(v=vs.100).aspx
原文地址:https://www.cnblogs.com/hzcya1995/p/13318721.html