> Am 20.01.2019 um 10:14 schrieb Martin Husemann <mar...@duskware.de>:
>
> On Sun, Jan 20, 2019 at 10:06:33AM +0100, Marc Balmer wrote:
>> Why are atexit handlers run after dlclosing loaded libraries? That sounds
>> wrong to me, but is there a reason?
>
> They are run at exit(1) time, the application (or in this case library)
> is responsible of removing them if it dlclose()s the library implementing
> them earlier.
So the _init / _fini functions in a shared library could handle that? How can
an atexit handler be unregistered?
fwiw, other operating systems unregister functions from a shared library
automatically at dlclose() time (e.g. macOS)
>
> However, this was a bug in the X libs and it has been fixed (AFAIR).
Yes, christos seems to have fixed it.
>
> Martin