mulle-nat / atexit-breakage

😱 dlclose breaks atexit everywhere

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check when atexit callback is called

Neither MacOS nor Linux nor FreeBSD get this right. All call atexit during dlclose.

Build

mulle-make

or

(
   mkdir build &&
   cd build &&
   cmake .. &&
   make
)

Run

Linux / FreeBSD

./build/dlclose ./build/libbar.so

MacOS

./build/dlclose ./build/libbar.dylib

Output

-> dlopen
void bar(void)
-- install bar_atexit
<- dlclose
void bar_exit(void)   <<< TOO EARLY
-- install main_atexit
exit
void main_atexit(void)

About

😱 dlclose breaks atexit everywhere


Languages

Language:C 72.0%Language:CMake 28.0%