Re: [ROOT] external libraries

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Sep 16 2003 - 01:52:03 MEST


Hi Aaron,

On Tue, 2003-09-16 at 01:08, Aaron Chou wrote:
> Hi,
>  
> I have created a shared library (libA, for example) which is
> dynamically linked to ROOT using the rootcint dictionary generator to
> make the dictionary files.  It seems to work very well, at least for
> the set of self-contained classes in my library.  I have no trouble
> creating instances of my new classes, and invoking their methods.
>  
> Some questions for the experts:
>  
> Is it possible for the methods of these classes to invoke
> functions/methods from some arbitrary external shared library?  What
> is the procedure for doing this?  By this, I mean what should I put in
> my Makefile to create libA?  I assume something must by put in the
> Makefile--otherwise ROOT cannot know where to find the arbitrary
> external shared library. 
>
You don't have to put anything in your Makefile. You should just
explicitly load the other shared libs first in ROOT, using:
gSystem->Load("libOtherlib.so")
or to have this done automatically you can link you shared lib with
libOtherlib.so by specifying it on the link line when you create libA.
>  
> Or must these external functions be statically linked to my own shared
> library libA?  How would I do this:  statically link object code from
> an external static library to a dynamic shared library I am creating? 
> What are the 'ld' options I would have to use?
>
No need to statically link, just link with the other shared lib.

-- Fons

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://www.rademakers.org/fons/      Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET