[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: atexit



What makes you think it's not in libc6? The "atexit" function is
declared in stdlib.h.

$ grep atexit /usr/include/stdlib.h
extern int atexit (void (*__func) (void)) __THROW;
/* Call all functions registered with `atexit' and `on_exit',
   functions registered with `atexit' or `on_exit'.  */

$ nm /usr/lib/libc.a | grep atexit
         U __cxa_atexit
         w __start___libc_atexit
         w __stop___libc_atexit
atexit.o:
         U __cxa_atexit
00000000 T atexit
cxa_atexit.o:
00000000 T __cxa_atexit
old_atexit.o:
00000000 ? __elf_set___libc_atexit_element__cleanup__
         U __cxa_atexit
00000000 b added_atexit_handler.183
         U __cxa_atexit

---- <imexiting.c> -------
#include <stdlib.h>
#include <stdio.h>

void myexit (void)
{
   fprintf (stderr, "I'm exiting!\n");
}

int main (void)
{
   atexit (myexit);
   return 0;
}
---------------------------

$ ./imexiting
I'm exiting!

-- 
Eric G. Miller <egm2@jps.net>



Reply to: