From the on_exit(3) man page.This function comes from SunOS 4, but is also present in glibc. It
no longer occurs in Solaris (SunOS 5). Portable application should
avoid this function, and use the standard atexit(3) instead.
Glad you got things working.As _martin said, I resolved it with atexit() and a global value. It was for a web server, to detect termination of fork/eval process.
I've even found __cxa_atexit function from sources, which is similar, but it didn't work for me at all.
__cxa_atexit
isn't meant to be called directly by application-level code. See https://wiki.openoffice.org/wiki/GCC_cxa_atexit and GCC - C++ Dialect Options: -fuse-cxa-atexit
for more GCC-specific information; the clang implementation is presumably compatible, but I cannot guarantee that with a reasonable amount of certainty. Things may differ in the case of GCC compiled for the ARM EABI (GCC Internals: Target Hook bool TARGET_CXX_USE_AEABI_ATEXIT (void)
).