RE: Library auto-loading

From: Philippe Canal <>
Date: Wed, 14 Dec 2005 22:07:15 -0600

Hi Jerome,

The choice we made so far is that any time we see the 'mention' of class we look it up and load the corresponding library. Doint anything smarter would require us to also known the context in which the name is mention (not impossible but a little bit tricky ... since in particular the lookup has to be done __before__ a statement is fully parse).

Anyway the way I usually deal with this type of case is to have 2 macro. One in charge of the loading and one containing the code. The advantage of this, is that I can seamlessly move from interpreted to compiled. For example my loader script looks like:

// loader.C

   gROOT->ProcessLine(".L myscript.C");

Another alternative is to leverage the autoloader and tell him to load your library instead. For example you could prepend $HOME/pythia6 to your LD_LIBRARY_PATH. If the library name is different from the default name, then you have to write your own .rootmap file.


-----Original Message-----
From: [] On Behalf Of Jerome LAURET
Sent: Monday, December 12, 2005 9:32 PM
Subject: [ROOT] Library auto-loading

        While debugging a variant of
$ROOTSYS/exmples/pythiaExample.C, I came across a side effect of library loading. The macro contained one more function

Bool_t Charged(TMCParticle *p)

    While CINT interpreted the macro, interpretation of TMCParticle loaded, and respectively even BEFORE the macro entry point was called. Whenever the equivalent of pythiaExample() was called and subsequentely loadLibraries(), the gSystem->Load("$HOME/pythia6/libPythia6") did not do anything (the default installed libPythia6 was already loaded) making it impossible to debug a private version of libPythia6 [unless redefinition of LD_LIBRARY_PATH or similar which may not always be applicable].

        This behavior may potentially be confusing to users. Forward declaration of TMCParticle did not help by the way: the loading still occured contrary to expectations. Is this a known feature or is this a bug ??

        This is seen in 4.04.02 which has the additional known issue of needing a different variant of libPythia6 than previous ROOT versions ...

             ( o o )
Received on Thu Dec 15 2005 - 05:09:09 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:14 MET