Get access to dictionary in shared lib from TApplication

Dear rooters,

attached please find the example codes.

One can compile everything in src/ to a shared lib and created a .rootmap together with it:

$ make clean install

After setting up LD_LIBRARY_PATH, one can run ROOT scripts in tutorials/

$ root tutorials/somefile.C

I am trying to build up a stand alone program in EventDisplay/ by compiling it with the created shared libs:

$ cd EventDisplay/
$ make

There is no problem to compile. It is basically a simple GUI with several buttons to click. I use TApplication in the main function. When I press the button “start” to invoke a class called “XObject” included in the shared libs, I get the following warning:

Warning in TClass::TClass: no dictionary for class XObject is available

Since I can use the same class in CINT, I guess the dictionary for the class is generated. Do you have any idea why it does not work in a stand alone program?

Thanks, Jing

Your attachment is unreadable (not a tar.gz file).
However the problem is that you did not generate a dictionary for your class. CINT or ACLIC are doing it automatically for you. See examples in $ROOTSYS/test/Makefile showing how to generate the dictionaries for the test programs. More details in teh Users Guide.

Rene

Dear Rene,

sorry about the attachment. Please check it again. I actually created the dictionary in the shared lib using rootcint, I also use rlibmap to create .rootmap file. After setting up LD_LIBRARY_PATH, I can use .class XObject in CINT. So I assume the dictionary has been created.

The problem happens when I compile stand alone program with the shared lib…

steps to reproduce the problem:

tar xfvz xman.tar.gz

cd xman

make install

export LD_LIBRARY_PATH=/path/to/xman/lib:$LD_LIBRARY_PATH

cd EventDisplay

make

./EventDisplay

click “Start” button

check the output in terminal

Cheers, Jing

Hi,

The problem is that both your dictionaries (in src and in EventDisplay) have the same name. ROOT thus believe that once it has loaded the first, it no longer need to load the second since we assume that the same name indicates identity of dictionaries.

Simply rename the dictionary in EventDisplay to something else (for example edCINTDICT.cc) and the problem goes away.

Cheers,
Philippe.

[quote=“pcanal”]Hi,

The problem is that both your dictionaries (in src and in EventDisplay) have the same name. ROOT thus believe that once it has loaded the first, it no longer need to load the second since we assume that the same name indicates identity of dictionaries.

Simply rename the dictionary in EventDisplay to something else (for example edCINTDICT.cc) and the problem goes away.

Cheers,
Philippe.[/quote]

Dear Philippe,

great. Thanks a lot!

Cheers, Jing