[gambit-list] Dynamic loading

Marc Feeley feeley at IRO.UMontreal.CA
Mon Oct 25 18:49:37 EDT 2004


[Note that you need to subscribe to gambit-list to post a message there...]

> > 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.
> 
> Perhaps I'm wrong in thinking that nothing need be changed to do this
> on OS X (except changing -shared to -dynamic), but I get a slightly
> different error with the suggested fix:
> 
> % gsc -flat -o foo.o1.c foo
> % gcc -dynamic -fPIC -D___DYNAMIC foo.c foo.o1.c -o foo.o1 -lgambc -I/usr/local/Gambit-C/include
> ld: Undefined symbols:
> _main

No, on Mac OS X you need the "-bundle" option.  For example:

  % uname -srmp
  Darwin 7.5.0 Power Macintosh powerpc
  % gcc -bundle -D___DYNAMIC m1.c m2.c m3.c foo.o1.c -o foo.o1
  % gsi foo.o1
  ((2 . 2) (4 . 4) (8 . 8) (16 . 16))

Marc


More information about the Gambit-list mailing list