Undefined typeinfo while loading library in compiled mode

Hello,

I run ROOT version 5.18.00a on lxPlus, i.e. Linux versions for IA-32 and AMD64 architectures. Recently I have got a new tool to work with, which consists of a shared library built from source and a ROOT macro which loads and uses it. The whole set-up works fine in interpreted mode, however whenever I try to run the macro in compiled mode I get the following error:

$ root -q -b urqmd_to_root.C+
[...]
dlopen error: ./urqmd_to_root_C.so: undefined symbol: _ZTI6PEvent
Load Error: Failed to load Dynamic link library ./urqmd_to_root_C.so
*** Interpreter error recovered ***
$

Attached you will find an archive containing the source code of the library (with the three “offending” parts of Event.h - see below - commented out) along with urqmd_to_root.C.

I have managed to narrow the problem down to three declarations in Event.h. If PEvent inherits TObject, ~PEvent() is declared as virtual, or the ClassDef macro is present, typeinfo cannot be found; if all of them are removed or commented out, the code starts fine (except it isn’t really useful because I need PEvent to inherit TObject).

Could you help me figure out what is wrong here?

Cheers,
MS
libEvent-typeinfo_problems.tar.gz (6.73 KB)

Never use gROOT->Reset in a function (this unloads everything loaded so far in the dictionary includes this function!).

[code]	gSystem->Load("libEvent.so");[/code]If you are loading your scripts via ACLiC, this _must_ be executed before attempting to load the code.  C++ code will only be executed _after_ the library load is completed and hence the linker will complain (because libEvent.so is not yet loaded).

Cheers,
Philippe[/quote]

Never use gROOT->Reset in a function (this unloads everything loaded so far in the dictionary includes this function!).

gSystem->Load("libEvent.so");If you are loading your scripts via ACLiC, this must be executed before attempting to load the code. C++ code will only be executed after the library load is completed and hence the linker will complain (because libEvent.so is not yet loaded).

Cheers,
Philippe[/quote]

Is there any way this can be done automatically when I run the macro? It would be extremely inconveniencing if one had to do it by hand, and having it loaded every time ROOT starts by moving the Load() line to rootlogon isn’t exactly optimal.

Hi,

Yes, if you load libEvent.so before calling ACLiC then the produced library with be hard linked (on most platforms) against libEvent.so.

Cheers,
Philippe.