source: trunk/libs/newlib/src/newlib/libc/stdlib/cxa_atexit.c @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 787 bytes
Line 
1/*
2 * Implementation of __cxa_atexit.
3 */
4
5#include <stddef.h>
6#include <stdlib.h>
7#include <reent.h>
8#include <sys/lock.h>
9#include "atexit.h"
10
11#ifdef _REENT_SMALL
12
13#include "on_exit_args.h"
14
15/* force linking of static instance of _on_exit_args */
16const void * const __cxa_atexit_dummy = &__on_exit_args;
17
18#endif  /* def _REENT_SMALL */
19
20/*
21 * Register a function to be performed at exit or DSO unload.
22 */
23
24int
25__cxa_atexit (void (*fn) (void *),
26        void *arg,
27        void *d)
28{
29#ifdef _LITE_EXIT
30  /* Refer to comments in __atexit.c for more details of lite exit.  */
31  int __register_exitproc (int, void (*fn) (void), void *, void *)
32    __attribute__ ((weak));
33
34  if (!__register_exitproc)
35    return 0;
36  else
37#endif
38    return __register_exitproc (__et_cxa, (void (*)(void)) fn, arg, d);
39}
Note: See TracBrowser for help on using the repository browser.