The information in this article applies to:
SYMPTOMS
After you dynamically unload an AppWizard-generated Microsoft Foundation
Class (MFC) Extension DLL, an access violation may occur as you try to gain
access to Windows resources. The last MFC function on the call stack is
usually AfxFindResourceHandle(). CAUSEWhen AppWizard generates the program template for an Extension DLL, it is not including a call to AfxTermExtensionModule(). This function removes the DLL from the list of loaded MFC Extension DLLs. Since this list is used when searching for resources, an access violation may occur after an AppWizard-generated Extension DLL is freed. RESOLUTIONAdd the following line to the DLL_PROCESS_DETACH section of an AppWizard- generated Extension DLL's DllMain():
extensionDLL should be the same static value passed to
AfxInitExtensionModule() in the DLL_PROCESS_ATTACH section. This value
should be different for every Extension DLL.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual C++ 5.0. MORE INFORMATIONNOTE: Dynamically loading and unloading MFC Extension DLLs was not
supported in versions prior to Visual C++ 4.0. Dynamically loading or
freeing Extension DLLs built with earlier versions could corrupt static
MFC state information. Additional query words: _AFXDLL gpfault gpf
Keywords : kbtool kbwizard kbDLL kbMFC kbVC kbVC500fix |
Last Reviewed: August 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |