[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

opencount set to 2 on dlopen using glibc 2.2.5-16

From: Dan Towner
Subject: opencount set to 2 on dlopen using glibc 2.2.5-16
Date: Wed, 21 May 2003 12:01:26 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0

Hi all,

I am using the dlopen/dlclose functions to dynamically load a set of
library functions. The library is written in C++ (with extern "C"
functions), and the program which uses the dl* functions is written in
C. For one particular library that I load, I was getting strange
errors, which I eventually traced to a sequence something like:

handle = dlopen(someFile)

This closes a library, and reopens it, effectively resetting the
libraries internal structures. I discovered that the dlclose wasn't
actually unloading the library, and thus when the library was
reopened, the original library structures were still present, and
caused various problems.

I eventually traced the reason for the library not being unloaded
(using LD_DEBUG=files), which is that the opencount appears to be set
to 2, the first time the library is loaded:

19792:  calling init: ./addDi.gdb
19792:  opening file=./addDi.gdb; opencount == 2

Thus, when I call dlclose, the opencount goes to 1, and the library is
not unloaded.

I cannot determine the reason why the opencount is set to 2 the first
time? How do I interpret the LD debug files to work out why this is
set like this?

I do not get this problem when using glibc 2.2.2-6.1 (Mandrake 8).



Daniel Towner
picoChip Designs Ltd., Riverside Buildings, 108, Walcot Street, BATH, BA1 5BG
07786 702589

reply via email to

[Prev in Thread] Current Thread [Next in Thread]