Hi Valentine, Your Makefile did not work for me. To make teh things running, just execute the following commands to build your executable rootcint -f dict.C -c MyClass.h+ g++ -g `root-config --cflags` -c dict.C MyClass.C g++ -g -Wl,-soname,MyClass.so -shared dict.o MyClass.o -o MyClass.so g++ -o crt crt.C `root-config --cflags --libs` MyClass.so I have modified one line in your program to select split=1 run crt. This produces tree.root In a Root session, you can then do: root > TFile f("tree.root"); root > T->Draw("fX") Rene Brun On Fri, 14 Nov 2003, Valentine Kouznetsov wrote: > Thanks to Rene's help I'm able to embed my ROOT-less class into ROOT Tree > (the class without any knowledge of ROOT). But in order to read that tree and > do some stuff I need to load my dictionary into root. > > My question now is how to embed this dictionary to the tree in order to allow > loading my tree and accessing my class object without loading object's > dictionary. > > What I found that it's possible if I add ClassDef into my class, BUT > my class is ROOT-less and it will need to know where to get this definition. > I don't want to include any ROOT header file into my class definition, but > I would expect that can be done in the dictionary itself. > > I'm attaching my class, macros, etc. to this Email. > Here the definitions: > MyClass is ROOT-less aware class > crt.C is a main program to create a root tree with this class > I compile dictionary/shared library using Makefile > and executable to create tree using > g++ -o create_tree -I$ROOTSYS/include crt.C -L$ROOTSYS/lib -lCore -lTree > -lCint -lm -lstdc++ -ldl MyClass.o mydict.o > > So, to be clear in order to have access to my tree with dictionary I need to > load the macro > gSystem->Load("libMy.so"); > TFile f("tree.root"); > TTree *T = (TTree*)f.Get("T"); > T->Print(); > > and I would like to avoid loading my libMy.so and want to embed my dictionary > into tree itself and generate this tree with my dictionary. > > Thank you, > Valentine.
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET