[xsd-users] dlclose and xsd cxx-tree

Skunk Worx skunkworx at verizon.net
Sat Jul 21 15:32:10 EDT 2012


On 07/13/2012 02:02 AM, Boris Kolpackov wrote:
> Hi John,
>
> Skunk Worx<skunkworx at verizon.net>  writes:
>
>> I seem to be having a problem with xsd cxx-tree and dlclose().
>>
>> [...]
>>
>> ...why, after a successful dlclose(), is the .so still referenced in the
>> application memory?
>
> I did some searches and there appears to be a bug either in GCC or glibc
> (there doesn't seem to be a consensus on this). See these two threads
> for more information:
>
> http://gcc.gnu.org/ml/gcc-help/2011-05/msg00403.html
> http://www.cygwin.com/ml/binutils/2011-05/msg00376.html
>
>
>> It is my understanding that this will result in an invalid .so
>> initialization if the .so is subsequently reopened by the same
>> application instance.
>
> I did some testing and what happens is dlclose() is simply ignored.
> As a result, a subsequent dlopen() is also ignored. So it is ok
> to re-load the library with this bug.
>
> Boris
>

Boris,

Thank you for finding this. I was pretty lost.

I contacted the Fedora Users and GNU libc-help mailing lists about this.

The only response from GNU is that the following 2008 POSIX description 
of dlclose() is interpreted as "dlclose() is advisory in nature".

http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlclose.html

They interpret the text as having no requirement for dlclose() to result 
in the destructors being called on a .so file.

In my experience this contradicts everything I've ever seen with the 
dlopen() / dlclose() of an .so file, but that's that.

I'll just have to work around the bloat with a application level .so 
wrapper or something.

Regards,
John



More information about the xsd-users mailing list