diff --git a/mingw-w64-crt/def-include/crt-aliases.def.in b/mingw-w64-crt/def-include/crt-aliases.def.in index 4796549c3..9e7b13b65 100644 --- a/mingw-w64-crt/def-include/crt-aliases.def.in +++ b/mingw-w64-crt/def-include/crt-aliases.def.in @@ -115,7 +115,7 @@ ADD_UNDERSCORE(memccpy) ADD_UNDERSCORE(memicmp) ADD_UNDERSCORE(mkdir) ADD_UNDERSCORE(mktemp) -; ADD_UNDERSCORE(onexit) +; onexit function alias is provided by misc/_onexit.c ADD_UNDERSCORE(open) #ifndef CRTAPP ADD_UNDERSCORE(putch) diff --git a/mingw-w64-crt/misc/_onexit.c b/mingw-w64-crt/misc/_onexit.c index 9caf0f75d..a51fa3fc9 100644 --- a/mingw-w64-crt/misc/_onexit.c +++ b/mingw-w64-crt/misc/_onexit.c @@ -11,3 +11,6 @@ _onexit_t __cdecl _onexit(_onexit_t func) return atexit((void (__cdecl *)(void))func) == 0 ? func : NULL; } _onexit_t __cdecl (*__MINGW_IMP_SYMBOL(_onexit))(_onexit_t func) = _onexit; + +_onexit_t __attribute__ ((alias ("_onexit"))) __cdecl onexit(_onexit_t); +extern _onexit_t (__cdecl * __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_onexit))))) __MINGW_IMP_SYMBOL(onexit))(_onexit_t);