配套设施 英文:_USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
来源:百度文库 编辑:九乡新闻网 时间:2024/04/28 00:59:01
http://blog.csdn.net/honker110/archive/2011/01/06/6120810.aspx 常见的编译参数VC建立项目时总会定义"Win32"。控制台程序会定义"_CONSOLE",否则会定义"_WINDOWS"。Debug版定义"_DEBUG",Release版定义"NDEBUG"
与MFC DLL有关的编译常数包括:
_WINDLL 表示要做一个用到MFC的DLL
_USRDLL 表示做一个用户DLL(相对MFC扩展DLL而言)
_AFXDLL 表示使用MFC动态链接库的 regular DLL
_AFXEXT 表示要做一个MFC扩展DLL
所以:
Regular, statically linked to MFC _WINDLL,_USRDLL
Regular, using the shared MFC DLL _WINDLL,_USRDLL,_AFXDLL
Extension DLL _WINDLL,_AFXDLL,_AFXEXT Building Your DLL When compiling regular DLLs that statically link to MFC, the symbols "_USRDLL" and "_WINDLL" must be defined. Your DLL code must also be compiled with the following compiler switches:•/D_WINDLL signifies the compilation is for a DLL
•/D_USRDLL specifies you are building a regular DLL When compiling regularDLLs that statically link to MFC, the symbols "_USR DLL" and"_WINDLL" must be defined. Your DLL code must also be compile dwith the following compiler switches:When compiling regular DLLs that dynamicallylink to MFC, you must define t he above symbols and use the above compilerswitches. Additionally, the sy mbol "_AFXDLL" must be definedand your DLL code must be compiled with:•/D_AFXDLL specifies that you are building a regular DLL that dynamicall y links to MFCThe interfaces (APIs) between the application and the DLL must beexplicitlyexported. It is recommended that you define your interfaces to be lowbandw idth, sticking to C interfaces where possible. More direct C interfaces areeasi er to maintain than more complex C++ classes.Place your APIs in aseparate header that can be included by both C and C++files (that way you won'tlimit your DLL customers to C++ programmers). Se e the header ScreenCap.h in theMFC Advanced Concepts sample DLLScreen Cap for an example. To export yourfunctions, enter them in theEXPORTSs ection of your moduledefinition file (.DEF) or include__declspec(dllexpor t)on yourfunction definitions. Use__declspec(dllimport)to import thesefunctions into the client executable.You must add the AFX_MANAGE_STATE macro at the beginning of all the e xportedfunctions in regular DLLs that dynamically link to MFC to set the curr ent modulestate to the one for the DLL. This is done by adding the followingline of codeto the beginning of functions exported from the DLL: AFX_MANAGE_STATE(AfxGetStaticModuleState( )) WinMain->DllMainThe MFC library defines the standard Win32DllMain entry point that initializ es yourCWinAppderived object as in a normal MFC application. Placeall DLL-specific initialization in the InitInstance memberfunction as in a normal MFC application.
发表于 @ 2011年01月06日 17:10:00
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/honker110/archive/2011/01/06/6120810.aspx (#)
与MFC DLL有关的编译常数包括:
_WINDLL 表示要做一个用到MFC的DLL
_USRDLL 表示做一个用户DLL(相对MFC扩展DLL而言)
_AFXDLL 表示使用MFC动态链接库的 regular DLL
_AFXEXT 表示要做一个MFC扩展DLL
所以:
Regular, statically linked to MFC _WINDLL,_USRDLL
Regular, using the shared MFC DLL _WINDLL,_USRDLL,_AFXDLL
Extension DLL _WINDLL,_AFXDLL,_AFXEXT Building Your DLL When compiling regular DLLs that statically link to MFC, the symbols "_USRDLL" and "_WINDLL" must be defined. Your DLL code must also be compiled with the following compiler switches:•/D_WINDLL signifies the compilation is for a DLL
•/D_USRDLL specifies you are building a regular DLL When compiling regularDLLs that statically link to MFC, the symbols "_USR DLL" and"_WINDLL" must be defined. Your DLL code must also be compile dwith the following compiler switches:When compiling regular DLLs that dynamicallylink to MFC, you must define t he above symbols and use the above compilerswitches. Additionally, the sy mbol "_AFXDLL" must be definedand your DLL code must be compiled with:•/D_AFXDLL specifies that you are building a regular DLL that dynamicall y links to MFCThe interfaces (APIs) between the application and the DLL must beexplicitlyexported. It is recommended that you define your interfaces to be lowbandw idth, sticking to C interfaces where possible. More direct C interfaces areeasi er to maintain than more complex C++ classes.Place your APIs in aseparate header that can be included by both C and C++files (that way you won'tlimit your DLL customers to C++ programmers). Se e the header ScreenCap.h in theMFC Advanced Concepts sample DLLScreen Cap for an example. To export yourfunctions, enter them in theEXPORTSs ection of your moduledefinition file (.DEF) or include__declspec(dllexpor t)on yourfunction definitions. Use__declspec(dllimport)to import thesefunctions into the client executable.You must add the AFX_MANAGE_STATE macro at the beginning of all the e xportedfunctions in regular DLLs that dynamically link to MFC to set the curr ent modulestate to the one for the DLL. This is done by adding the followingline of codeto the beginning of functions exported from the DLL: AFX_MANAGE_STATE(AfxGetStaticModuleState( )) WinMain->DllMainThe MFC library defines the standard Win32DllMain entry point that initializ es yourCWinAppderived object as in a normal MFC application. Placeall DLL-specific initialization in the InitInstance memberfunction as in a normal MFC application.
发表于 @ 2011年01月06日 17:10:00
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/honker110/archive/2011/01/06/6120810.aspx (#)
_USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
军牌车的具体含义
军牌车的具体含义
军牌车的具体含义
军牌车的具体含义
军牌车的具体含义123
VS编译时自动引用Debug|Release版本的dll - Kevin Yang的博客 - 博客园
VC++ 6.0 编译 opencv1.0 中 cvaux.dll的3个错误原因
什么是恩格尔系数?它的具体含义是什么?
行为文化的具体含义是什么
读懂庄家具体动作的含义
三皈依的含义
军牌车的具体含义 - 萝卜网 - 人人都是艺术家
asp.net源程序编译为dll文件并调用过程
揭秘:男人三种体质的具体养生方法
揭秘:男人三种体质的具体养生方法
结构体对齐的具体含义|结构体,对齐,含义,fdsfdsa
几种常见编译警告的处理
MFC的DLL
DLL
礼佛三拜的含义,及方法
佛教的“三皈依”有哪些含义
IP 地址的分类,A、B、C 类的具体含义与分类方法?2
IP 地址的分类,A、B、C 类的具体含义与分类方法2?