LCG dictionaries - Cintex in Cint and compiled programs

Hi Cint experts,

I have a problem trying to access the Reflex information contained in the LCG dictionaries in compiled programs. I give you a recipe to reproduce the problem with ROOT 5.26 (the myclass.h, classes_def.xml and myprog.cpp files are attached):

Generate the dictionaries for the class “myclass” and create a shared library:

genreflex myclass.h -s classes_def.xml -o LCGdict.cc -I $ROOTSYS/include
g++ myclass.h LCGdict.cc -o libmylib.so  `root-config --cflags --libs`  -lReflex -lCintex -shared

At this point, the class can be used in the cint interpreter with

gSystem->Load("libCintex.so");Cintex::Enable();
gSystem->Load("libmylib.so");

And it works fine: both I/O (myclass inherits from TObject) and symbol lookup.

Then to compile and execute the program:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./
g++ myprog.cpp -o myprog.exe  `root-config --cflags --libs` -lReflex  -L ./ -lmylib
./myprog.exe

And I get a:

Error in TClonesArray::SetClass: called with a null pointer

I tried some solutions myself, and I removed the above error playing a bit with TCint, for example adding in my program:

TCint cint("cint","cint");
cint.ProcessLine("gSystem->Load(\"libCintex.so\");");
ROOT::Cintex::Cintex::Enable();

Beyond being more or less ugly, this patch does not solve the problem since if I then try a:

myclass o;
o.Dump();

I get this output:
==> Dumping object at: 0x0902abc0, name=myclass, class=myclass

m_mymember 0
fUniqueID 0 object unique identifier
fBits 0x03000000 bit field status word

*** Break *** segmentation violation
Segmentation fault

Is anyone able to give the recipe to use LCG dictionaries in a shared library linked to a compiled program?

Cheers,
Danilo

Hi,

you need to create a TApplication object, not a TCint object. That should fix it.

Cheers, Axel