C++ ABI Summary -- 5 August meeting

Martin von Loewis loewis at informatik.hu-berlin.de
Tue Aug 10 11:18:17 UTC 1999


> What this implies to me is that atexit, and the part of the runtime
> library that handles destructors for static objects, must know about
> each other.

Of the compilers I'm using, only MSVC gets this right - they use
atexit to register the destructor function.

I think there should be a way to implement the standard requirement no
matter how stupid the requirement is; I personally think it is good
that it is specified. 

Using atexit is straight-forward, but breaks for DSOs that are
unloaded early (dlopen/dlclose): atexit will call a function that is
not there, anymore. To support this case as well, atexit would need an
unregistration mechanism, e.g.

- atexit_cookie (void (*func)(void), void* cookie)
  registers a function for atexit, associating it with the cookie
- unregister_atexit (void *cookie)
  removes the function associated with cookie from the list of
  functions to call

That, of course, is an extension to the base API.

Regards,
Martin




More information about the cxx-abi-dev mailing list