[ROOT] Bug in loading and unloading libraries?

From: Paolo Adragna (paolo.adragna@pi.infn.it)
Date: Thu Oct 21 2004 - 09:52:17 MEST


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