Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cxa_atexit.c « stdlib « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ae2d21a605b91edca67b0991a27a79ec8e088e0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Implementation of __cxa_atexit.
 */

#include <stddef.h>
#include <stdlib.h>
#include <reent.h>
#include <sys/lock.h>
#include "atexit.h"

#ifdef _REENT_SMALL

#include "on_exit_args.h"

/* force linking of static instance of _on_exit_args */
const void * const __cxa_atexit_dummy = &__on_exit_args;

#endif	/* def _REENT_SMALL */

/*
 * Register a function to be performed at exit or DSO unload.
 */

int
__cxa_atexit (void (*fn) (void *),
	void *arg,
	void *d)
{
#ifdef _LITE_EXIT
  /* Refer to comments in __atexit.c for more details of lite exit.  */
  int __register_exitproc (int, void (*fn) (void), void *, void *)
    __attribute__ ((weak));

  if (!__register_exitproc)
    return 0;
  else
#endif
    return __register_exitproc (__et_cxa, (void (*)(void)) fn, arg, d);
}