[gambit-list] Dynamic loading

Marc Feeley feeley at IRO.UMontreal.CA
Sun Oct 24 09:26:56 EDT 2004


> Hello, I'm trying out the example instructions for bundling multiple 
> source files into something that can be loaded with `load', but it 
> appears a symbol is missing: (this is on linux)
> 
> % gsc -flat -o foo.c m2 m3
> % gcc -shared -fPIC -D___DYNAMIC m1.c m2.c m3.c foo.c -o foo.o1 
> -I/usr/local/Gambit-C/include
> % gsi foo
> *** ERROR IN ##main -- /tmp/foo.o1: undefined symbol: ____20_foo_2e_o1
> (load "foo")

The documentation is out of sync.  Now you have to explicitly add the ".oN"
extension of the generated shared library in the name of the C file.
That is you should do this:

  % gsc -flat -o foo.o1.c m2 m3
  % gcc -shared -fPIC -D___DYNAMIC m1.c m2.c m3.c foo.o1.c -o foo.o1  -I/usr/local/Gambit-C/include

This is necessary to allow multiple versions of a module to be loaded
at the same time on some systems.

Marc


More information about the Gambit-list mailing list