The support for dynamic libraries in scsh turned out to be quite
useful already. I have therefore updated the scsh-yp package to use
Automake and libtool to build a shared library and added a rule to the
makefile that creates a scheme file to load this library.
The mechanism to build this Scheme file is obviously not the right
thing to do but serves as a proof of concept. I did also not yet add
an install target for the scheme code as we will probably want to do
this from scsh.
Anyway, after using ./autogen.sh to setup the build environment,
./configure (using --prefix and --with-scsh-includes) and make install
for building and installing the shared objects, you can now do in the
source directory:
[0 gasbichl@ventoux yp-scsh] make scheme/load-yp.scm
(echo '(user)'; \
echo "(open 'dynamic-externals)"; \
echo "(open 'external-calls)"; \
echo '(run '; \
echo " '(let ((initializer-name \"scsh_yp_main\")"; \
echo ' (module-file
"/home/gasbichl/i386_fbsd46/scsh-yp/lib/libscshyp.so"))'; \
echo ' (dynamic-load module-file)'; \
echo ' (call-external (get-external initializer-name))))'; \
echo '(config)'; \
echo '(load "yp-interfaces.scm")'; \
echo '(load "yp-packages.scm")'; \
) > scheme/load-yp.scm
[0 gasbichl@ventoux yp-scsh] cd scheme/
[0 gasbichl@ventoux scheme] scsh
Welcome to scsh 0.6.4 (Olin Shivers)
Type ,? for help.
> ,exec ,load load-yp.scm
load-yp.scm
Load structure dynamic-externals (y/n)? y
[dynamic-externals
/afs/informatik.uni-tuebingen.de/i386_fbsd46/scsh-0.6.4//lib/scsh/big/external.scm]
yp-interfaces.scm
yp-packages.scm
'#{Imported-binding "scsh_yp_next"}
> ,open yp
Load structure yp (y/n)? y
[yp yp.scm]
> (yp-bind)
#t
I think this shows that it's indeed worthwhile to talk about dynamic
libraries in the packaging standard.
--
Martin
|