VC + + dynamic link Library programming MFC extension DLL

Source: Internet
Author: User

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).

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.