__cxa_finalize and `on_exit'

Jim Dehnert dehnert at baalbek.engr.sgi.com
Fri Dec 17 23:50:28 UTC 1999


> From mitchell at codesourcery.com  Thu Dec 16 21:30:53 1999
> From: Mark Mitchell <mark at codesourcery.com>
> Date: Thu, 16 Dec 1999 21:28:30 -0800
> 
> What I'm suggesting is:
> 
>   o As in the ABI, atexit calls __cxa_atexit.
> 
>   o When `exit' is called, it invokes all the things registered with
>     all of __cxa_atexit, atexit, and (possibly) on_exit.
> 
>   o When a shared library is unloaded, it calls __cxa_finalize, which
>     behaves exactly as in the ABI.
> 
>   o When a main program exits, it does not call __cxa_finalize.
>     Instead, it just calls exit.  That does the things described
>     above.
> 
> There's no circularity there.  And on_exit calls still work.  There's
> no need to call on_exit functions when a dso is unloaded, so there's
> no need to modify __cxa_finalize in any way.  Whether __cxa_finalize
> and exit actually share common code or not is up to the implementors;
> what is clear is that they must share the same list of registered
> functions.

OK, I understand now.  This could work, _except_ that it would fail to
put the on_exit calls into "proper" sequence without further
modification.  This isn't a Standard issue, of course, since on_exit is
a non-standard extension, but my guess is that users think of it as
equivalent to atexit (with enhancements).  So wouldn't it be cleaner to
finish the job?

Anyone else have comments?  Should we reopen this issue?

Jim

-	    Jim Dehnert		dehnert at sgi.com
				(650)933-4272




More information about the cxx-abi-dev mailing list