[gambit-list] Generating standalone executables with the compiler's functions
Per Eckerdal
per.eckerdal at gmail.com
Thu Nov 10 18:52:26 EST 2011
Thanks, that's exactly what I was looking for!
--
Per Eckerdal
On torsdag 10 november 2011 at 21:33, Marc Feeley wrote:
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20111111/0c590221/attachment.htm>
More information about the Gambit-list
mailing list