[gambit-list] Generating standalone executables with the compiler's functions
Marc Feeley
feeley at iro.umontreal.ca
Thu Nov 10 15:33:09 EST 2011
On 2011-11-10, at 2:37 PM, Per Eckerdal wrote:
> Hi,
>
> I'm trying to compile a scheme file that uses Gambit's compiler functions to a standalone executable. Is there any good/obvious way of doing that?
>
> This illustrates my problem:
>
> $ cat t.scm
> (write compile-file)
> $ gsc -exe t.scm
> *** WARNING -- "compile-file" is not defined,
> *** referenced in: ("/Users/per/prog/gambit/blackhole/tmp/t.c")
> $ ./t
> #!unbound
>
Because you are linking with more than the base library, you need additional linking steps:
1) explicit linking (with gsc -link) with the link file ~~lib/_gambcgsc.c (this is an incremental link because this link file extends the base library)
2) explicit linking (at the C level) with the library ~~lib/libgambcgsc.a
Here's an example, tested on Mac OS X:
% ls t*
t.scm
% cat t.scm
(pp compile-file)
% GAMBCLIBDIR="`gsc -e \"(display (path-expand \\\"~~lib\\\"))\"`"
% gsc -link -l "$GAMBCLIBDIR/_gambcgsc.c" t.scm
% gsc -obj t_.c t.c
t_.c:
t.c:
% gsc -exe -ld-options "$GAMBCLIBDIR/libgambcgsc.a" t_.o t.o
% ./t
#<procedure #2 compile-file>
% ls t*
t t.c t.o t.scm t_.c t_.o
Marc
More information about the Gambit-list
mailing list