The lib::atexit is a reentrancy-safe version of std::atexit with support for additional parameter.
void lib::atexit (void (* callback) (void *), void * param);
The lib::atexit is implemented in terms of std::atexit. The whole mechanism is registered to be invoked when the application exists using std::atexit the first time the lib::atexit is called. Thus, there must be at least one position remaining in the std::atexit implementation when the lib::atexit is called for it to work properly.
You will need to include "ext/lib_bits/atexit.cpp" into your project in order to use lib::atexit.
The C standard demands at least 32 positions for std::atexit to be available, but in C++, some of these are usually used for global destructors (GCC).