From: Jacek Caban <jacek@codeweavers.com> --- dlls/ucrtbase/Makefile.in | 1 + dlls/ucrtbase/atexit.c | 47 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 dlls/ucrtbase/atexit.c diff --git a/dlls/ucrtbase/Makefile.in b/dlls/ucrtbase/Makefile.in index c9e5c3a31f7..768844fb1c6 100644 --- a/dlls/ucrtbase/Makefile.in +++ b/dlls/ucrtbase/Makefile.in @@ -9,6 +9,7 @@ VER_FILEDESCRIPTION_STR = "Wine runtime library" VER_PRODUCTVERSION = 10,0,14393,2247 SOURCES = \ + atexit.c \ console.c \ cpp.c \ crt_gccmain.c \ diff --git a/dlls/ucrtbase/atexit.c b/dlls/ucrtbase/atexit.c new file mode 100644 index 00000000000..142de9efa0c --- /dev/null +++ b/dlls/ucrtbase/atexit.c @@ -0,0 +1,47 @@ +/* + * atexit implementation + * + * Copyright 2026 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep implib +#endif + +#ifdef __WINE_PE_BUILD + +#include <process.h> +#include <stdarg.h> +#include <windef.h> +#include <winbase.h> +#include <wine/asm.h> + +static _onexit_table_t atexit_table = { 0 }; + +int __cdecl atexit(_PVFV func) +{ + return _register_onexit_function(&atexit_table, (_onexit_t)func); +} + +void __wine_exec_atexit(void) +{ + _execute_onexit_table(&atexit_table); +} + +__ASM_SECTION_POINTER( ".section .CRT$XTB", __wine_exec_atexit ) + +#endif -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10121