Re: TROOT object static declaration ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Nov 03 1999 - 18:20:57 MET


Hi Yannick,
You are hitting a machine dependent problem connected with the order
in which shared libs are initialized.

If you use a TApplication (or TRint ) object inside your main program,
your problems will be solved. TApplication will take care of making
a correct initialisation of the dictionaries if not yet done.

See examples in $ROOTSYS/test/hworld, guitest, stress

Rene Brun


Patois Yannick wrote:
> 
> Hi rooters,
> 
> If I follow the TROOT object declaration as explained on it's web page
> (http://root.cern.ch/root/html/TROOT.html) it doesnt work for me :
> 
> -----
> #include <TROOT.h>
> #include <TFile.h>
> #include <TTree.h>
> #include "C_brut_plastic_data.H" // <-- This is my ROOT class
> 
> TROOT root_stuff("test","test analysis");
> 
> void toto(void);
> 
> main()
> {
>   toto();
> }
> 
> void toto(void)
> {
>   TFile *root_file;
>   TTree *orion_events;
>   C_brut_plastic_data brut_plastic_data;
>   root_file = new TFile("toto.root","RECREATE","Orion events");
>   orion_events = new TTree("orion_events","Orion manip events");
>   orion_events->Branch("brut_plastic","C_brut_plastic_data",&brut_plastic_data);
> }
> ----
> I compile the main and C_brut_plastic_data.cpp, create the dictionary,
> compile it and link. But...
> 
> The complain is when I create the branch :
> Warning in <TClass::TClass>: no dictionary for class C_brut_plastic_data is available
> 
> If now I just change the status of 'root_stuff', passing it from a
> static object to a local object of main :
> 
> -----
> #include <TROOT.h>
> #include <TFile.h>
> #include <TTree.h>
> #include "C_brut_plastic_data.H" // <-- This is my ROOT class
> 
> void toto(void);
> 
> main()
> {
>   TROOT root_stuff("test","test analysis");
>   toto();
> }
> 
> void toto(void)
> {
>   TFile *root_file;
>   TTree *orion_events;
>   C_brut_plastic_data brut_plastic_data;
>   root_file = new TFile("toto.root","RECREATE","Orion events");
>   orion_events = new TTree("orion_events","Orion manip events");
>   orion_events->Branch("brut_plastic","C_brut_plastic_data",&brut_plastic_data);
> }
> ----
> 
> The code seems to work and there's no warning anymore.
> 
> I dont really understand why... Did I miss something ?
> 
>         Yannick
> 
> PS : sun CC compiler CC5 in compat=4 mode
> 
>  _/ Yannick Patois _________________ Address (home) __________________
> | irc(undernet): Garp on #france25+ | La Villa des Sciences            |
> | email : patois@ganil.fr           | 12, avenue de Cambridge          |
> | web :http://www.sura.org/~patois/ | 14200 Herouville-Saint-Clair     |
> | Tel/Fax-home:+33 (0)2 31 94 50 32 | FRANCE                           |
> |___________________________________|__________________________________|



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET