[gambit-list] newbie question: how do I invoke functions in a shared library

Marc Feeley feeley at iro.umontreal.ca
Sun Apr 8 22:56:02 EDT 2007

On 7-Apr-07, at 8:13 PM, HP Wei wrote:

> Can anyone tell me how I go about using a shared library
> compiled on a Sun-solaris with gambit.4.0b22 ?
> Note: gsi and gsc were built with --enable-shared
> Here is the process of building termite as shared lib.
> (1) download termite.tar.gz from the web site
>     untar it to
>     ~/gambit/current/termite
> (2) cd ~/gambit/current
>     gsc -link -o termite.c termite/termite.scm
> (3) gcc -shared -fPIC -D___LIBRARY -D___SHARED termite.c -o
>     libtermite.so
> (4) mv libtermite.so to ~/gambit/current/lib
> ----------------------------------
> Questions:
>    (a) in a gsi session,  how do I use functions in libtermite.so ?
>    (b) what about in a compiled scm file which uses functions in  
> termite ?

Why don't you simply compile Termite to a dynamically loadable file  
(i.e. termite.o1) and load that with a (load "termite")?

Alternatively you could build a shared library which includes the  
Gambit runtime system and Termite, and then use that as a base  
runtime system when linking applications which use Termite.

I have an example of how this can be done (including makefile) for  
the GLUT OpenGL library on Mac OS X.  It is not Termite and not  
Solaris, but it may clarify how to build a library as a dynamically  
loadable file and as a shared library.  The GLUT example is also  
interesting because it shows how to link to an existing non-trivial C  


-------------- next part --------------
A non-text attachment was scrubbed...
Name: glut.tar.gz
Type: application/x-gzip
Size: 1770 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20070408/6b3b32b7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20070408/6b3b32b7/attachment.sig>

More information about the Gambit-list mailing list