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.PD 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
* __MINGW_IMP_SYMBOL(_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
);
33 _onexit_t __cdecl
mingw_onexit(_onexit_t func
)
39 onexitbegin
= (_PVFV
*) _decode_pointer (__onexitbegin
);
41 if (onexitbegin
== (_PVFV
*) -1)
42 return (* __MINGW_IMP_SYMBOL(_onexit
)) (func
);
44 onexitbegin
= (_PVFV
*) _decode_pointer (__onexitbegin
);
45 onexitend
= (_PVFV
*) _decode_pointer (__onexitend
);
47 retval
= __dllonexit (func
, &onexitbegin
, &onexitend
);
49 __onexitbegin
= (_PVFV
*) _encode_pointer (onexitbegin
);
50 __onexitend
= (_PVFV
*) _encode_pointer (onexitend
);
51 _unlock (_EXIT_LOCK1
);
58 return (mingw_onexit((_onexit_t
)func
) == NULL
) ? -1 : 0;