BUG: Freeing Resource DLLs in ExitInstance Causes Error
PSS ID Number: 202197
Article Last Modified on 10/16/2002
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q202197
SYMPTOMS
In Windows 95, calling FreeLibrary() on the resource DLLs in the ExitInstance() function of the COleControl-derived class causes an application error.
CAUSE
This is a bug in Windows 95. When FreeLibrary() is called on resource DLLs, Windows 95 is running through the chain of DLLs in that process and looking for other DLLs that have a zero reference count. This causes other DLLs to be unloaded too soon.
RESOLUTION
Move the FreeLibrary() calls to the destructor function of the COleControl-derived class.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. REFERENCES
(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Yeong-Kah Tam, Microsoft Corporation.
Additional query words: ocx ExitInstance FreeLibrary LoadLibraryEx LoadLibrary
Keywords: kbBug kbDLL KB202197
Technology: kbAudDeveloper kbMFC kbVC32bitSearch kbVC500 kbVC500Search kbVC600 kbVCNET kbVCsearch