Hi John,
John Pretz <pretz@umdgrb.umd.edu> wrote concerning
[ROOT] Loading Shared Libraries... [Wed, 5 Nov 2003 22:53:06 -0500 (EST)]
----------------------------------------------------------------------
> Hi,
>
> I have an application that has several sub-packages. Each package is
> compiled into its own shared library. The packages are compiled with
> standard makefiles and I'm trying to arrange it so that when these
> packages are built that they can be loaded into a root session by default
> from a central location taking into account all the dependencies of the
> shared libraries so that they are loaded in the right order.
>
> I thought I had it working. When each package is built it makes a
> small root script which declares what its dependencies are. There's a
> .rootrc file in the central directory. It calls for a rootlogon.c script
> which searches through the package directories for the .so files and these
> dependency-declaring scripts. It calls each script to find out the
> dependencies and then loads the libraries in the correct order.
Another way to make this happen automatically, is to link your shared
libraries to it's dependencies. A concrete example could be
libEGPythia6.so which depends on libPythia6.so. A command line like
OBJECTS = ...
SO = g++ -shared
SOFLAGS = -Wl,soname,$@
libEGPythia6.so: $(OBJECTS)
$(SO) $(SOFLAGS) -o $@ $^ -L/path/to/libPythia6 -lPythia
when you load this library dynamically using
dlopen("libEGPythia.so", RTLD_GLOBAL|RTLD_NOW)
(and by extension `TSystem::Load'), the library `libPythia.soŽ is
pulled in automatically too.
Caveat: Works on GNU/Linux - I have no idea how it works on other UNIX
systems, MacOSX, or Windoze.
BTW, you get this for free with Autotools :-)
Yours,
___ | Christian Holm Christensen
|_| | -------------------------------------------------------------
| | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91
_| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91
_| Denmark Office: (+45) 353 25 404
____| Email: cholm@nbi.dk Web: www.nbi.dk/~cholm
| |
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET