[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More questions about writing extensions.
Quoting Robert John Andersen:
> Lets say I have 2 libraries that i want to interface to, lib1 and lib2 and
> lib2 uses lib1. I also have an additional .module that I created for
> miscellaneous stuff that my libraries (mylib1, mylib2) will use. When
> using my module should I create an so and if so where can I put it so that
> mylib1.so and mylib2.so can pick it up? Does it have to be in the users
> LD_LIBRARY_PATH or users /etc/ld.so.conf or can I put it in the PLT
> directories somewhere?
You can probably set LD_LIBRARY_PATH before calling `load-extension'.
It worked for me under Linux, at least. Here's an example where b.so
needs helper.so:
% cd /home/mflatt/tmp
% mzc --ld b.so b.o helper.so
% cd ..
% mzscheme
Welcome to MzScheme ...
> (load-extension "tmp/b.so")
load-extension: couldn't open "/usr/home/mflatt/tmp/b.so" (helper.so:
cannot open shared object file: No such file or directory)
> (putenv "LD_LIBRARY_PATH" "/home/mflatt/tmp/")
#t
> (load-extension "tmp/b.so")
-2
where -2 was the expected result.
> I would like to be able to write 2 shareable objects mylib1.so and
> mylib2.so and be able to load just mylib1.so or load mylib2.so and
> mylib1.so. I was wondering if I could accomplish this with using units and
> having the files mylib1.ss and mylib2.ss?
Yes. If mylib1.so and mylib2.so produce units, then mylib1.ss could
return the mylib1.so unit, and mylib2.ss could return a compound unit
linking the mylib1.so and mylib2.so units.
Matthew