RE: [ROOT] Bug in loading and unloading libraries?

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Oct 21 2004 - 18:23:17 MEST


Hi,

With gcc 3.3.1 on a redhat 7.3 machine, I can __not__ reproduce your
problem.
The 5 tests behaves as you expect:

bash-2.05a$  dynalib-norootlib.exe myclass-nodict-norootlib.so
main: trying dlopen ...
dlopen: : Success
main: trying dlclose ...
dlclose: Success
main: going to return ...
bash-2.05a$  dynalib-norootlib.exe myclass-dict-norootlib.so
main: trying dlopen ...
dlopen: ./myclass-dict-norootlib.so: undefined symbol: G__search_typename2
bash-2.05a$ dynalib-norootlib.exe myclass-dict-rootlib.so
main: trying dlopen ...
dlopen: : Success
main: trying dlclose ...
dlclose: Success
main: going to return ...
bash-2.05a$ dynalib-rootlib.exe myclass-dict-norootlib.so
main: trying dlopen ...
dlopen: : Success
main: trying dlclose ...
dlclose: Success
main: going to return ...
bash-2.05a$  dynalib-norootlib.exe myclass-nodict-rootlib.so
main: trying dlopen ...
dlopen: : Success
main: trying dlclose ...
dlclose: Success
main: going to return ...

Cheers,
Philippe. 

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]
On Behalf Of Paolo Adragna
Sent: Thursday, October 21, 2004 2:52 AM
To: roottalk
Subject: [ROOT] Bug in loading and unloading libraries?


Dear all,

in these days me and my collegues are revising some code, dealing with
dynamic loading and unloading of libraries. Due to problems and crashes, we
set up a minimum program as a testbed from our development. The program is
inside the attached tar file or can be found in 

/afs/cern.ch/user/a/adragna/public/dlopen-cint.tar.bz2

In the directory "scripts" there are some scripts with obvious names.

Compiling everything with the "compile.sh" script you can see the following
executables:

1) dynalib-norootlib.exe
2) dynalib-rootlib.exe

and the following libraries:

a) myclass-nodict-norootlib.so
b) myclass-nodict-rootlib.so
c) myclass-dict-norootlib.so
d) myclass-dict-rootlib.so


The difference between the two executables is the following:
dynalib-rootlib.exe is linked against ROOT libs, in case some dlls would
like to use them. dynalib-norootlib.exe is not linked (compare compile.sh)

More or less it is the same for the libraries:
a) myclass-nodict-norootlib.so is not linked and, also,  it has not the
dictionary
b) myclass-nodict-rootlib.so is linked but it has not the dictionary
c) myclass-dict-norootlib.so is not linked but it has the dictionary
d) myclass-dict-rootlib.so has both the linking and the dictionary

Let's do the following trials.

1- dynalib-norootlib.exe myclass-nodict-norootlib.so

That's right: my library doesn't need to link ROOT libraries, everything
works fine.

2- dynalib-norootlib.exe myclass-dict-norootlib.so 

This won't never work: ROOT libraries are never loaded but I nedd them
because of the disctionary. As matter of facts, this trial doesn't succed,
as expected. Good!

3- dynalib-norootlib.exe myclass-dict-rootlib.so 

Everything works fine also this time. The library myclass-dict-rootlib.so
load herself the needed ROOT libraries. So far, so good.

4- dynalib-rootlib.exe myclass-dict-norootlib.so

It should work, with the libraries provided by the executable. But it
crashes!! How can it happen? It seems a ROOT bug, but maybe there is
something I didn't understand.

5- dynalib-norootlib.exe myclass-nodict-rootlib.so

It should work because the ROOT libraries are loaded by dlopen but never
used (what's more, there is no dictionary), but also in this case we get a
crash!

Of course there are other combinations, but I think our problem is clear.

Comments on this behaviour? Solutions on these crashes?

Thank you all,

Paolo Adragna


--
Paolo Adragna
Istituto Nazionale di Fisica Nucleare
Sezione di Pisa
Via Buonarroti, 2 - Edificio C - Stanza 203
56127 Pisa - Italia
Tel. +39 050 221 4912



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET