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 library.
Marc