static constructors/destructors and atexit
Steven Parkes
parkes@sierravista.com
Tue Aug 11 12:45:00 GMT 1998
I liked the earlier idea of a specialized atexit() for this purpose. If,
for example, a small version of atexit() designed for the job were put in
libgcc2, who calls the real atexit() only once, you could use it on all
systems (not just those with "broken atexit()s"). Something with a name
like __dtoratexit() or similar.
As someone mentioned, this is not standards-conforming. The standard
requires that local static destruction be interleaved with atexit()
callbacks and this won't do that.
The problem I've come across, though, is getting atexit() callbacks to
happen on machines when we overload atexit(). Isn't this going
to require reimplementing crt0 and/or reverse engineering the system
crt0?
And that doesn't even touch machines where DLLs resolve to the system
atexit() at link time.
More information about the Gcc
mailing list