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(); } On which platform do you see this problem? It looks like the static initializers, that register your classes to the cint dictionary, are not correctly called. -- Fons On Thu, 2002-10-24 at 19:17, Brett Viren wrote: > Hi roottalk, > > There is a problem I have battled with many times and I wondered what > others have done to solve it. > > We have a ROOT based executable ("loon") which is essentially just > root.exe plus some of our libs linked in by default. The problem I > have is say I have a libMyClass.so which is *not* linked in by default > and defines a class "MyClass", I find it very difficult to write > a macro file which loads libMyClass and also uses MyClass. Eg: > > shell> cat myclass.C > { > gSystem->Load("libMyClass.so"); > > MyClass *mc = new MyClass; > ... > } > shell> loon myclass.C > > This fails with something like: > > Error: Symbol MyClass is not defined in current scope > FILE:myclass.C LINE:4 > > Apparently this is because CINT parses the entire file before > interpreting it. > > So. I was wondering if there is some way to handle this well. > Normally, I must break up the loading of the libs in to a separate > script from the one actually using of this class. > > -Brett. -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:15 MET