Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Any way to catch exit()? Message-ID: <1988Aug29.165649.10514@utzoo.uucp> Organization: U of Toronto Zoology References: <8808261432.AA11635@ucbvax.Berkeley.EDU> <967@cbnews.ATT.COM> <771@philmds.UUCP> Date: Mon, 29 Aug 88 16:56:49 GMT In article <771@philmds.UUCP> leo@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@zoo.toronto.edu