This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Use of atexit for destructors on Solaris 7.
- To: c dot galambos at eim dot surrey dot ac dot uk, gcc-bugs at gcc dot gnu dot org
- Subject: Re: Use of atexit for destructors on Solaris 7.
- From: Mike Stump <mrs at windriver dot com>
- Date: Wed, 22 Mar 2000 16:29:25 -0800 (PST)
> To: gcc-bugs@gcc.gnu.org
> Date: Wed, 22 Mar 2000 10:17:47 +0000
> From: Charles Galambos <c.galambos@eim.surrey.ac.uk>
> Since 'atexit' on solaris is function ptr it can be replaced. (Is
> this part of the standard ??)
Nope.
> Is there a way I can replace the atexit function before or at least
> early in the initilisation of static variables ?
Yes, if you put it in the right place on the link line, in a
constructor, you have have it run early.
> It would have been good also if failure of the atexit function
> wasn't silently ignored, especailly as most implementations seem to
> have a limit of the the number of times it can be called.
Yes, xatexit (f) { if (atexit (f) == FAILURE) throw out_of_memory; }
or something like this seems the most logical.
libgcc2 should do this for us, as we never check it in the generated
code.