Re: [ROOT] using C library routines in ROOT

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Sep 27 2001 - 08:49:53 MEST


Hi Bill,

I suppose that your question is
 "How to call C functions from the ROOT interpreter CINT?"

In the list of ROOT HOWTOs at : http://root.cern.ch/root/Howto.html

Look at the URL: http://root.cern.ch/root/HowtoCERNLIB.html

This Howto describes the steps to generate the interfaces to Fortran or C
functions in existing libraries. To be short, you need two files:
  -file1.h containing the prototype of all the functions to call
  -LinkDef.h containing the list of functions with for each function
             a statement like "#pragma link C function myFunction;"

Then, you use the preprocessor rootcint to generate the C++ interface code
that you compile and link with your application.

The HOWTO unfortunately describes only a way to link the generated code
with your own ROOT application. Instead, I recommend to make a shared lib
with the interface functions prelinked with your C static libs or shared libs.
In this way you can easily dynamically link your shared lib from teh standard
ROOT executable module root.exe

Rene Brun

William Hanlon wrote:
> 
> Hi,
> 
> I would like to use existing C library routines from ROOT. I've looked
> at a lot of the HOWTO's, User's Guide, tutorials, but I don't think
> there are instructions on how to do this without rewriting the C
> routines in C++ shared object libraries (seems like a lot of work if
> the existing libraries are available).
> 
> Has anyone done this or does anyone know how to do this? Please point
> me to the right documents to read or post an example if this is
> possible.
> 
> Thanks,
> Bill
> 
> --
> William Hanlon                       http://www.physics.rutgers.edu/~whanlon
> Rutgers University                   pgp fingerprint:85 68 43 55 9A 83 44 00
> Dept. of Physics and Astronomy                       CE 19 C0 B0 D9 DE D6 52



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