RE: [ROOT] Bootstrapping a script.

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Oct 24 2002 - 22:32:47 MEST


Hi Brett,

For those cases I use a script similar to:
// start script.
{
  gSystem->Load("libraries.so");
  gROOT->ProcessLine(".x testload.C");
}

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Brett Viren
Sent: Thursday, October 24, 2002 2:34 PM
To: Fons Rademakers
Cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] Bootstrapping a script.


Hi Fons,

Fons Rademakers writes:
 > Hi Brett,
 > 
 >   cint interprets line by line so it should work. This works for me:
 > 
 > {
 >    gSystem->Load("libPhysics.so");
 > 
 >    TLorentzVector *v = new TLorentzVector;
 >    v->Print();
 > }

Yes, that works for me also, but this doesn't:

// testload.C
void do_it();
void testload ()
{
    gSystem->Load("libPhysics.so"); 

    do_it();
}
class VecBurp {
    TLorentzVector *fLV;
public: 
    VecBurp(TLorentzVector* lv);
    ~VecBurp();

    void Burp();
};
void do_it()
{
    VecBurp* mc = new VecBurp(new TLorentzVector);
    mc->Burp();
}
VecBurp::VecBurp(TLorentzVector* lv)
{
    fLV = lv;
}
VecBurp::~VecBurp() 
{
}
void VecBurp::Burp()
{
    fLV->Print(); 
}
// end testload.C


It gives:


shell> root testload.C
...
  *   Version   3.03/09   22 October 2002   *
...
root [0] 
Processing testload.C...
Error: Symbol TLorentzVector is not defined in current scope
FILE:testload.C LINE:10
Error: Symbol fLV is not defined in current scope  FILE:testload.C
LINE:10
*** Interpreter error recovered ***


If I explicitly load the lib before .x'ing it works:

shell> root
root [0]  gSystem->Load("libPhysics.so")
(int)0
root [1] .x testload.C           
Note: File "/home/bviren/cvs/root/gcc-3.0/lib/libPhysics.so" already loaded
OBJ: TLorentzVector	TLorentzVector	A four vector with (-,-,-,+) metric

 > On which platform do you see this problem? 

Debian GNU/Linux x86, GCC 3.0.4.  ROOT CVS as of ~2 days ago.

 > It looks like the static
 > initializers, that register your classes to the cint dictionary, are not
 > correctly called.

You mean something wrong in my code or in the code generated by the
GCC I use?

-Brett.



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:15 MET