Microsoft KB Archive/199521

= PRB: User-Defined onexit/atexit/cexit Not Called If /MD or /MDd =

Article ID: 199521

Article Last Modified on 10/2/2003

-

APPLIES TO


 * Microsoft Visual C++ 4.0 Cross Development Edition for Macintosh
 * Microsoft Visual C++ 4.0 Cross Development Edition for Macintosh

-



This article was previously published under Q199521



SYMPTOMS
User-defined onexit, atexit, and cexit routines are not called for PowerMac applications using the C run-time dynamic-link library (DLL), /MD or /MDd.



CAUSE
DLLs and applications have different arrays of onexit pointers. The Win32 libraries have a method for ensuring both arrays are run through when the application terminates; however, this was not put in place for PowerMac DLLs.

Also, note that special handling is required for user-built DLLs!



RESOLUTION
Following are some possible ways to resolve this problem:


 * Use the static version instead of the DLL version of the C run-time libraries.
 * Clean up in the destructor of a global C++ object.

Additional query words: _cexit cexit _onexit

Keywords: kbprogramming kbprb KB199521

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.