This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Proposed change to DYNAMIC LINKING



I think we might need a change to the way dynamic linking works.
Let me explain...

Let's say I have two modules.. (X11 gXt) and (X11 gXm). Both are
implemented
by shared libraries written in C. The libgXm.so depends on libgXt.so.

Now it had seemed a good idea to install these two libraries into
/usr/local/lib
and set LD_LIBRARY_PATH=/usr/local/lib. Then symlink these libraries
into
/usr/local/share/guile/site/X11/gXt. Then the built in UNIX dynamic
linker
could find libraries in /usr/local/lib (Which it needs to when the code
inside
libgXm.so starts calling libgXt code). And the guile dynamic linking
facility
can find them where it expects in /usr/local/share/guile/site/X11/gXt.

The trouble is that if you do this, the system thinks you want to load
two 
different libgXt.so libraries. Apart from the waste of memory, all the
static
variables in the library will occur twice and the whole thing doesn't
work.

Now we could change LD_LIBRARY_PATH to point to every single module
directory.
But when you are using many many modules with submodules,
LD_LIBRARY_PATH
will get to be as long as your arm.

I suspect the right thing to do is to have the guile dynamic linker
somehow
make use of LD_LIBRARY_PATH. Maybe the algorithm is that it first
searches
for libraries in LD_LIBRARY_PATH, and only if that fails does it look in
%load-path.

If I'm right, I hope someone takes up the challenge of doing it, because
I didn't want to delve this deeply into the guts of guile in my first
week
of use! :-)

-- 
Chris Bitmead
http://www.ans.com.au/~chrisb
mailto:chrisb@ans.com.au