Microsoft KB Archive/103860
PRB: Destructor for Class in a DLL Called Twice
PSS ID Number: Q103860 Article last modified on 12-23-1993
|The information in this article applies to:|
|- Microsoft Win32 Software Development Kit (SDK) for Windows NT, version 3.1|
The application has the following properties and generates an access violation at exit: - There is a C++ class in a dynamic-link library (DLL) - Objects of this class type use dynamic memory - The application was built using the SDK tools
Under the following conditions, the destructor for the class in the DLL will be called twice, and therefore the memory will be freed twice, causing the access violation.
This problem does not occur when using Visual C++ for Windows NT.
This problem can be easily demonstrated by adding a CString to the DLLTrace sample program.
Additional reference words: 3.10 KBCategory: KBSubcategory: Copyright Microsoft Corporation 1993.