Any way to catch exit()?

Henry Spencer henry at utzoo.uucp
Tue Aug 30 02:56:49 AEST 1988


In article <771 at philmds.UUCP> leo at philmds.UUCP (Leo de Wit) writes:
>... It seems that if stdio is not used
>a simple version of _cleanup is used; if it IS used, a complicated one
>is used that does a _filewalk() or something. Probably has something to
>do with keeping binary sizes small, but I can't figure out how you can
>have several _cleanup() 's in one library. Anyone knows?

I don't know how Ultrix is doing it, but the way V7 did it was to use a
non-ranlibbed libc and have two versions of _cleanup, one preceding
exit and the other following it.  The first one was tied to stdio by
some carefully-crafted external references, so it would be picked up if
stdio was in use, while the second one would be picked up if the first
wasn't.  You can't do this with a single ranlibbed library, at least not
that I know of, but you can pull the same trick by using more than one
library and getting the search order right.

It is in any case somewhat academic, since stdio is practically universal
these days.
-- 
Intel CPUs are not defective,  |     Henry Spencer at U of Toronto Zoology
they just act that way.        | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list