__cxa_finalize and `on_exit'
Mark Mitchell
mark at codesourcery.com
Fri Dec 17 00:03:06 UTC 1999
The GNU C library supports the BSD/SunOS-ish `on_exit' as well as
`atexit'. A function registered with on_exit is just like one
registered with atexit, except that it (like functions registered with
__cxa_atexit) takes a parameter, and that parameter is registered at
on_exit time.
In addition, the function registered with on_exit is passed the
exit-status when exit is called.
But, __cxa_finalize doesn't know the exit-status, even when called
with NULL to indicate that the main program is exiting, so it can't
call the on_exit functions correctly.
I suggest that we mandate that __cxa_finalize is always called with a
non-NULL parameter, or that it immediately return if passed a NULL
parameter.
Let's just let exit do it's normal thing (which will include calling
__cxa_atexit-registered functions), and use __cxa_finalize only for
DSOs.
--
Mark Mitchell mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the cxx-abi-dev
mailing list