Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


For MFC database (or DAO) support from a regular DLL that is dynamically linked to MFC, add a call to this function in your regular DLL's CWinApp::InitInstance function to initialize the MFC database DLL.

void AFXAPI AfxDbInitModule( );

Make sure this call occurs before any base-class call or any added code which accesses the MFC database DLL. The MFC database DLL is an extension DLL; in order for an extension DLL to get wired into a CDynLinkLibrary chain, it must create a CDynLinkLibrary object in the context of every module that will be using it. AfxDbInitModule creates the CDynLinkLibrary object in your regular DLL's context so that it gets wired into the CDynLinkLibrary object chain of the regular DLL.

Header: <afxdll_.h>

© 2015 Microsoft