From: Eric Marsden <emarsden@mail.dotcom.fr>
Newsgroups: comp.lang.scheme.scsh
Subject: Re: compiling an image
Date: 29 Jun 2001 09:57:35 +0200
Organization: LAAS-CNRS http://www.laas.fr/
Message-ID: <wzig0cjwweo.fsf@mail.dotcom.fr>
>>>>> "bd" == briand <briand@zipcon.net> writes:
bd> I was hoping someon could provide an example of compiling an
bd> image. The manual talks about using scsh.hlink but it doesn't
bd> seem to exist.
start by dumping a heap image of your program:
% scsh -lm modules.scm -l world.scm \
> -e '(dump-scsh-program "main" "world.img")'
you can then make this heap image executable by inserting a #!
trigger, as per section 10.2 of the scsh manual. You can further
transform this heap image into a native executable without any runtime
dependencies (other than the C runtime and standard dynamically linked
libraries) using the static heap linker, which is called static.scm
(not scsh.hlink as the manual says)
% /usr/lib/scsh/scsh/static.scm -i world.img -o world.exe
Resulting executables are rather large, since they contain the image
plus a copy of the virtual machine, but they do start up fairly
quickly.
-------------- world.scm ------------------
#!/home/emarsden/local/bin/scsh \
-lm modules.scm -o world -e main -s
!#
(define (main . args)
(display "Hello, world!
"))
---------------modules.scm-----------------
(define-structure world
(export main)
(open scsh
scheme)
(files world))
-------------------------------------------
--
Eric Marsden <URL:http://www.laas.fr/~emarsden/>
Up
|