Re: [ROOT] Functions in a shared library

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Feb 06 2001 - 18:15:10 MET


Hi Thomas,

Assuming a file Thomas.C containing one or more functions that you usually
call via the interpreter, you can compile automatically this file and make a
shared lib with:
  root > .L Thomas.C++
This will create a shared lib named Thomas_C.so
Next time you run, you can do
  root > gSystem->Load("Thomas_C")
and then call your functions.

Note that in order to use this nice feature, your file Thomas.C must be a valid
C++
file. In particular, you must have all teh relevant include declarations at teh
beginning of the file.
It is a good practice to always specify the list of includes. When running
in interpreter mode via CINT, these include will be ignored if not relevant.
All that is explained in the Root Users Guide.

Note that if you load more than one shared lib, the load sequence must
correspond to the order of dependencies. If libB requires functions/classes of
libA,
you must load libA first.

Rene Brun


Thomas Eberl wrote:
> 
> Dear rooters,
> 
> I have written several functions which I usually load into CINT to use
> them on the interpreter level. These functions use classes which I have
> put in a shared library following the instructions in the ROOT manual. I
> wonder now if it is possible to compile my functions and put them also
> into the shared library. Unfortunately, the manual doesn't say anything
> about this. It should be, however, easily possible ?! Could somebody
> give me an example ????
> 
> Many thanks and regards
> 
> Thomas



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET