Hi Mark, When you compile, you do not need to specify the shared lib. You have to specify all includes necessary to compile the code. I want to emphasize again the nice facility provided by the Root script compiler facility. See below Rene Brun Script Compiler =============== This new ROOT facility facilitates the use of an external compiler to 'interpret' a C++ root macro (script). The external compiler will be called to create a shared library that is automatically loaded. The interface is simple and extend the use of the .X, .x and .L cint commands. For any of this command if '++' is appended to the name of the script file, the script compiler is invoked. For example: .X myFunc.C++(arg1,arg2) will compile the file myFunc.C, load the resulting shared library and invoke the function myFunc(arg1,arg2). (As as reminder if the ++ is dropped, the cint interpreter is used to parse and execute the script). The script compiler cannot currently digest any C++ code that does contain a 'main' function or the redefinition of any ROOT global variables (like TROOT). For the script to be both understandable by cint (via .X myFunc.C ) and by the script compiler (via .X myFunc.C++ ) follow the following rules (some of these made be relaxed at a latter date): - contain all needed include files. - contain forward declaration for all classes used in function declaration (this need to be visible by cint) - If the script has a supporting header file, for example defining some extra classes, the header has to be in the same directory as the script in order for its content to be available directly from the command prompt. For example: // This is a ROOT Script myScript.C // that just draw and fit and histogram #include "TH1.h" class TH1; void myScript( TH1* h, const char * formula ) { h->Draw(); h->Fit(formula); } The script compiler is set to use the same compiler and compiler flags as ROOT. This can be modified using the following new methods in the TSystem class: Get/SetIncludePath, Get/SetMakeSharedLib and Get/SetMakeExe. Typically only the include should need to be modified. For example: gSystem->SetIncludePath("-I$ROOTSYS/include -I$HOME/mypackage/include"); For more details refer to the documentation of TSystem::CompileMacro and TSystem::SetMakeSharedLib. We are currently working on an extension of this facility. Fututure versions of Root should be able to detect automatically the list of include files. Mark James Boland wrote: > > Hello ROOT useres, > > I have a macro to do my analysis using ROOT but I would like to speed it > up by compiling it into an executable. My analysis macro uses a library > libEvent.so which I load with the statement > > gSystem.Load("libEvent.so");// Load event and scaler classes > > How do I include this library when compiling? > > Thanks, > Mark > > ___________________________________________________________________ > Mark Boland markjb@physics.unimelb.edu.au > School of Physics PhD Student > The University of Melbourne Photonuclear Group > Fax: +61 3 9347 4783 Ph: +61 3 9344 5426
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:17 MET