ReactOS  0.4.14-dev-49-gfb4591c
atonexit.c
Go to the documentation of this file.
1 
7 #undef CRTDLL
8 #ifndef _DLL
9 #define _DLL
10 #endif
11 
12 #include <oscalls.h>
13 #include <internal.h>
14 #include <stdlib.h>
15 #include <crtdefs.h>
16 #include <limits.h>
17 //#include <windows.h>
18 
19 #define _EXIT_LOCK1 8
20 
21  void __cdecl _lock (int _File);
22  void __cdecl _unlock (int _File);
23 
26 
29 
30 /* Choose a different name to prevent name conflicts. The CRT one works fine. */
32 
34 {
35  _PVFV *onexitbegin;
36  _PVFV *onexitend;
37  _onexit_t retval;
38 
39  onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin);
40 
41  if (onexitbegin == (_PVFV *) -1)
42  return (* __MINGW_IMP_SYMBOL(_onexit)) (func);
44  onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin);
45  onexitend = (_PVFV *) _decode_pointer (__onexitend);
46 
47  retval = __dllonexit (func, &onexitbegin, &onexitend);
48 
49  __onexitbegin = (_PVFV *) _encode_pointer (onexitbegin);
50  __onexitend = (_PVFV *) _encode_pointer (onexitend);
52  return retval;
53 }
54 
55 int __cdecl
57 {
58  return (mingw_onexit((_onexit_t)func) == NULL) ? -1 : 0;
59 }
#define _EXIT_LOCK1
Definition: atonexit.c:19
GLenum func
Definition: glext.h:6028
void(__cdecl * _PVFV)(void)
Definition: internal.h:33
void __cdecl _lock(int _File)
Definition: lock.c:97
#define __cdecl
Definition: accygwin.h:79
void *__cdecl _encode_pointer(void *)
Definition: mingw_helpers.c:25
#define _CRTIMP
Definition: crtdefs.h:60
_PVFV * __onexitbegin
Definition: atonexit.c:24
_CRTIMP _onexit_t __cdecl __dllonexit(_onexit_t, _PVFV **, _PVFV **)
_onexit_t __cdecl _onexit(_In_opt_ _onexit_t _Func)
_PVFV * __onexitend
Definition: atonexit.c:25
smooth NULL
Definition: ftsmooth.c:416
_onexit_t(__cdecl *__MINGW_IMP_SYMBOL(_onexit))(_onexit_t func)
int __cdecl atexit(_PVFV func)
Definition: atonexit.c:56
#define __MINGW_IMP_SYMBOL(sym)
Definition: _mingw_mac.h:53
void __cdecl _unlock(int _File)
Definition: lock.c:126
_onexit_t __cdecl mingw_onexit(_onexit_t func)
Definition: atonexit.c:33
void *__cdecl _decode_pointer(void *)
Definition: mingw_helpers.c:19