Remember reading, in order not to forget, mark look. .
a, Non-MFC DLL: refers to the structure without MFC class library, written in direct language with C DLL, the output of the function is generally a standard C interface, and can be written in non-MFC or MFC application that calls .
b, Regular (General) DLL: and the following Extension Dlls, as is written in MFC class library. Obvious feature is the source file a class that inherits CWinApp. It can be divided into static and dynamic connection to connect to the MFC to MFC's.
Static link to MFC in the dynamic link library are only VC Professional Edition and Enterprise Edition are supported. The application of such DLL inside the output function can be used any Win32 process, including the use of MFC applications. Input function has the following form:
extern "C" EXPORT YourExportedFunction ();
If there is no extern "C" modification, the output function can only call C + + code.
DLL application derived from CWinApp, but no message loop.
Dynamic link to MFC DLL application of rules inside the output function can be any Win32 program uses, including the use of MFC applications. However, all output from the DLL function should begin with the following statement:
AFX_MANAGE_STATE (AfxGetStaticModuleState ())
This statement is used to switch the MFC module state correctly.
Regular DLL can be all supported DLL technology applications written in languages that call. In this dynamic link library, it must have a CWinApp inherited from class, DllMain function is provided by the MFC, do not write their own explicit.
c, Extension DLL: used to implement the inherited from the MFC class to re-use, that is, with this type of dynamic link libraries, can be used to output one inherited from the MFC class. It is a function of the output can only be used MFC and dynamically linked to MFC application uses. Can inherit what you want from the MFC, more suitable for your own use class, and to provide it to your application. You are free to give your application to provide MFC or MFC derived class object pointer. Extension DLL to use MFC to create a dynamic link version, and it was only prepared to use MFC class library calls the application. Extension DLLs and Regular DLLs are different, it does not have a class inherited from CWinApp object, so you have to add their own initialization code DllMain function, and the end of the code.
And rules DLL, has the following differences:
1, which does not have a CWinApp derived from the object;
2, it must have a DllMain function;
3, DllMain is called AfxInitExtensionModule function, you must check the return value, if the return 0, DllMmain also return 0;
4, if it wants to output CRuntimeClass types of objects or resources (Resources), you must provide an initialization function to create a CDynLinkLibrary object. Also, it is necessary to initialize the function output;
5, use the MFC extension DLL application must have a class derived from CWinApp, and, generally call the extension DLL InitInstance where the initialization function.