MFC extension DLLs are the same as MFC rule DLLs because MFC class libraries can be used internally within both DLLs, except that MFC extension DLLs and application interfaces can be MFC. The meaning of an MFC extension DLL is that it is an extension of MFC, whose primary function is to implement a reusable class derived from an existing MFC library class. MFC extension DLLs Use the MFC dynamic link library version, so only MFC executable files (application or rule DLLs) that are built with a shared version of MFC can be used to use MFC extension DLLs.
As previously known, the MFC rule DLL was automatically added by the MFC wizard an CWinApp object, and the MFC extension DLL does not contain the object, it is only automatically added the DllMain function. For MFC extension DLLs, developers must add initialization and end code to the DLL's DllMain function.
From the table below we can see the different ways in which three kinds of DLLs handle DllMain entry functions:
DLL Type entry function
Non-MFC DLL programmers provide DllMain functions
InitInstance and ExitInstance of MFC rule DLL CWinApp objects
MFC Extension DLL MFC DLL Wizard generates DllMain functions
For MFC extension DLLs, the macros that are shown in the following table are automatically added to the project, which facilitates the writing of DLLs and applications. Macros such as Afx_ext_class, Afx_ext_api, and Afx_ext_data have different definitions in DLLs and applications, depending on whether the _afxext macros are defined. This enables the use of a unified macro in both DLLs and applications to represent the different meanings of output and input. In the DLL, the output is represented (because the _afxext is defined, usually by specifying/d_afxext in the compiler's identity parameter), and in the application, the input (_afxext is undefined).