Back to index

glibc  2.9
atexit.c
Go to the documentation of this file.
00001 /* Copyright (C) 1991, 1996, 1999, 2001, 2006 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    In addition to the permissions in the GNU Lesser General Public
00010    License, the Free Software Foundation gives you unlimited
00011    permission to link the compiled version of this file with other
00012    programs, and to distribute those programs without any restriction
00013    coming from the use of this file. (The GNU Lesser General Public
00014    License restrictions do apply in other respects; for example, they
00015    cover modification of the file, and distribution when not linked
00016    into another program.)
00017 
00018    Note that people who make modified versions of this file are not
00019    obligated to grant this special exception for their modified
00020    versions; it is their choice whether to do so. The GNU Lesser
00021    General Public License gives permission to release a modified
00022    version without this exception; this exception also makes it
00023    possible to release a modified version which carries forward this
00024    exception.
00025 
00026    The GNU C Library is distributed in the hope that it will be useful,
00027    but WITHOUT ANY WARRANTY; without even the implied warranty of
00028    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00029    Lesser General Public License for more details.
00030 
00031    You should have received a copy of the GNU Lesser General Public
00032    License along with the GNU C Library; if not, write to the Free
00033    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00034    02111-1307 USA.  */
00035 
00036 #include <stdlib.h>
00037 #include "exit.h"
00038 
00039 
00040 /* This is defined by newer gcc version unique for each module.  */
00041 extern void *__dso_handle __attribute__ ((__weak__));
00042 
00043 
00044 /* Register FUNC to be executed by `exit'.  */
00045 int
00046 #ifndef atexit
00047 attribute_hidden
00048 #endif
00049 atexit (void (*func) (void))
00050 {
00051   return __cxa_atexit ((void (*) (void *)) func, NULL,
00052                      &__dso_handle == NULL ? NULL : __dso_handle);
00053 }