__cxa_atexit question

Steve Ellcey sje@cup.hp.com
Tue May 9 20:50:00 GMT 2006


I have been investigating __cxa_atexit recently and I see that on Linux,
__cxa_atexit, __cxa_finalize, and atexit were put into libc intead of
into libstdc++.  I assume this was done because atexit was written to
call __cxa_atexit and C programs that call atexit need to link without
including the C++ runtime library.

On HP-UX the C++ folks did something different, they put a weak
definition of atexit in libc for C programs (one that doesn't use
__cxa_atexit) and then put a regular definition of atexit (written using
__cxa_atexit) along with __cxa_atexit and __cxa_finalize into the C++
runtime library.

I was wondering if building atexit, __cxa_atexit, and __cxa_finalize
into libstdc++ would be considered reasonable?  Obvious this would have
to be controllable based on platforms and/or a configure option since we
don't want these in the linux libstdc++ but other platforms (like HP-UX)
might want them in their libstdc++ libraries.

Has this idea been discussed before?

Steve Ellcey
sje@cup.hp.com



More information about the Libstdc++ mailing list