2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
21 void __cdecl
_lock (int _File
);
22 void __cdecl
_unlock (int _File
);
27 extern _CRTIMP _onexit_t
__dllonexit (_onexit_t
, _PVFV
**, _PVFV
**);
28 extern _onexit_t (__cdecl
*_imp___onexit
) (_onexit_t func
);
30 /* Choose a different name to prevent name conflicts. The CRT one works fine. */
31 _onexit_t __cdecl
mingw_onexit(_onexit_t func
)
37 onexitbegin
= (_PVFV
*) _decode_pointer (__onexitbegin
);
39 if (onexitbegin
== (_PVFV
*) -1)
40 return (*_imp___onexit
) (func
);
42 onexitbegin
= (_PVFV
*) _decode_pointer (__onexitbegin
);
43 onexitend
= (_PVFV
*) _decode_pointer (__onexitend
);
45 retval
= __dllonexit (func
, &onexitbegin
, &onexitend
);
47 __onexitbegin
= (_PVFV
*) _encode_pointer (onexitbegin
);
48 __onexitend
= (_PVFV
*) _encode_pointer (onexitend
);
49 _unlock (_EXIT_LOCK1
);
56 return (mingw_onexit((_onexit_t
)func
) == NULL
) ? -1 : 0;