reactos/sdk/lib/vcruntime/atexit.c
Timo Kreuzer f81c82f5fa [VCSTARTUP] Implement atexit and _onexit
These must use a local table and cannot use the one from ucrtbase.
The table is initialized with a .CRT section initializer.
2025-03-24 23:02:06 +00:00

18 lines
355 B
C

//
// atexit.c
//
// Copyright (c) 2024 Timo Kreuzer
//
// Implementation of atexit.
//
// SPDX-License-Identifier: MIT
//
#include <stdlib.h>
int __cdecl atexit(void (__cdecl* _Func)(void))
{
// Go through _onexit, so that the initializer is pulled in.
_onexit_t result = _onexit((_onexit_t)_Func);
return (result == NULL) ? -1 : 0;
}