_USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
来源:互联网 发布:labview软件逻辑图 编辑:程序博客网 时间:2024/06/05 03:22
_USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
常见的编译参数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 MFC
The 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 theAFX_MANAGE_STATEmacro 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->DllMain
The MFC library defines the standard Win32DllMainentry point that initializ es yourCWinAppderived object as in a normal MFC application. Placeall DLL-specific initialization in theInitInstancememberfunction as in a normal MFC application.
转自http://blog.csdn.net/honker110/article/details/6120810
- _USRDLL _AFXDLL _WINDLL _AFXEXT等宏控制的三种dll编译宏的具体含义
- _USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
- _USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
- _USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
- _USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
- _USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
- _USRDLL和_AFXDLL的用法
- gluPerspective的具体含义
- const的具体含义
- OOM的具体含义是什么
- where子句的具体含义
- 串口参数的具体含义
- 心电的具体含义?
- 委托机制的具体含义
- 串口参数的具体含义
- arm的具体含义是什么?
- Stack的三种含义
- Stack的三种含义
- ios UITapGestureRecognizer 单指单击、单指多击、多指单击、多指多击事件操作
- 各类函数总结
- XP远程桌面连接2008提示:远程计算机需要网络级别身份验证,而您的计算机不支持该验证
- Android 动态布局 动态生成 销毁控件 改变控件的位置等
- 禁止固定IP访问Linux系统
- _USRDLL _AFXDLL _WINDLL 三种dll编译宏的具体含义
- ios 横向滑动选择器 年份+月份
- phpExcel常用方法
- Matlab学习-图像处理工具箱函数
- JBPM4.4 入门 简单的请假流程
- android单位使用说明
- Vmware下Ubuntu NAT网络连接方式设置
- 一个完整的稳定的,单线程的,有正确的收发功能的使用epoll的socket服务程序
- 3ds max使用了attach之后怎么分离