Share via


Regular DLLs Dynamically Linked to MFC: Overview

OverviewHow Do IFAQDetailsSample

A regular DLL dynamically linked to MFC is a DLL that uses MFC internally, and the exported functions in the DLL can be called by either MFC or non-MFC executables. As the name describes, this kind of DLL is built using the dynamic-link library version of MFC (also known as the shared version of MFC). Functions are usually exported from a regular DLL using the standard C interface. For an example of how to write, build, and use a regular DLL, see the sample . For more information about regular DLLs that dynamically link to MFC, see the section titled “Converting DLLTRACE to Dynamically Link with the MFC DLL” in the abstract for the sample.

You must add the AFX_MANAGE_STATE macro at the beginning of all the exported functions in regular DLLs that dynamically link to MFC to set the current module state to the one for the DLL. This is done by adding the following line of code to the beginning of functions exported from the DLL:

AFX_MANAGE_STATE(AfxGetStaticModuleState( ))

For detailed information on converting a regular DLL that statically links to MFC to a DLL that dynamically links to MFC, see the section titled “Converting DLLTRACE to Dynamically Link with the MFC DLL” in the abstract for the sample.

What do you want to do?

What do you want to know more about?