This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: dlclose() with zero references does not call library destructor
- From: PaweÅ Sikora <pluto at agmk dot net>
- To: gcc-help at gcc dot gnu dot org
- Cc: charles quarra <charllsnotieneningunputocorreo at gmail dot com>
- Date: Wed, 03 Apr 2013 11:30:04 +0200
- Subject: Re: dlclose() with zero references does not call library destructor
- References: <CABdjY+=g+oL9=-taP7UuVAHi2AenW5ZBX1Kifft658MpcQ9Wpg at mail dot gmail dot com>
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.