dlclose() with zero references does not call library destructor

Paweł Sikora pluto@agmk.net
Wed Apr 3 09:30:00 GMT 2013


On Tuesday 02 of April 2013 22:31:15 charles quarra wrote:
> Hi,
> 
> All those debug logs show that each time i call dlclose the status
> result is zero. Success!
> 
> (...)
> Is this a bug or a simple misunderstanding from my part?

i think that dtors will be called during library unload and unload may be performed later.

dlopen manual:

   dlclose
       The  function dlclose() decrements the reference count on the dynamic library handle handle.
       If the reference count drops to zero and no other loaded libraries use symbols in it,
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       then the dynamic library is unloaded.



More information about the Gcc-help mailing list