What is the alternative. In my rootlogon.C, I do just as above. Do I need to call another macro from rootlogon.C after calling Load(“libEven”) that then creates the Event object, or is there a smarter way to do this?
Hi,
So far I am not aware of any smarter way. You need to execute gSystem->Load(“libEvent”); before void f() (better in a separate unnamed macro)
Cheers,
Vassil
Hi Whit,
The {/code/} is attached to a function declaration. The point is you need to force cling to compile the gSystem->Load(“library”); before you ‘request’ any of the symbols in the library. The way cling works is that instead of compiling/interpreting statement by statement it compiles bigger chunks of code at once such as functions (aka incremental inputs), but not necessarily. Say if you have:
[root] #include “myScript.h” // all this will be compiled in one go
This is why you cannot have the gSystem->Load residing in the same ‘compilation entity’.
Probably what you are looking for is starting root like this:
root -e"gSystem->Load(“MyLib”);"
Cheers,
Vassil
[quote]Probably what you are looking for is starting root like this:
root -e"gSystem->Load(“MyLib”);"[/quote]
That is clever. I suppose one could also add an alias like this if they are always used.
I am in my home directory with the files:
[ul]
[li].rootlogon.C - which does gSystem->Load(“lib”)[/li]
[li].rootconfiglib.C - which uses and configures new library[/li]
[li].rootrc[/li][/ul]
#.rootrc file
Rint.Logon: .rootconfiglib.C
Then if I run root in my home directory, everything goes well!
ROOT runs .rootlogon.C first, followed by .rootconfiglib.C.
But if I am not in $HOME it only runs the .rootlogon.C. This seems to go against the documentation which says [quote]the options are merged, with precedence local, user, global. [/quote]
I guess I could alias root -e "gROOT->ProcessLine(\".x /home/whit/.rootconfiglib.C\");" but that again seems ugly.
It would be quite nice if in addition to .rootlogon.C there was another automatic script which would be for the purpose of loading libraries before the rootlogon.C.
Or better yet, just group the script explicit “chunks”
{
{
gSystem->Load("libSomething.so");
}
Something *s = new Something();
}
It is legal code that serves no purpose in C++ that i know of.
I agree that there are plenty of options out there, however this is of low priority in our work plan so it will have to wait probably after 6.0
Cheers,
Vassil