Martin Gasbichler writes:
> So, I still don't see your problem...
I have to confess I haven't been trying the interpreted version. So
here is my test:
hyde259% cat test1.scm
#!/usr/local/bin/scsh \
-dm -o program -e main -s
!#
(define-structure program
(export foo main)
(open scheme scsh)
(begin
(define *stuff* '())
(define (foo x)
(set! *stuff* (cons x *stuff*)))
(define (bar)
(load "test2.scm"))
(define (main args)
(bar)
(display *stuff*)
(newline))))
hyde260% cat test2.scm
(foo 'a)
(foo 'b)
(foo 'c)
hyde261% ./test1.scm
test2.scm
(c b a)
hyde262% make test1
./make-scsh-image.scm test1.scm -lm modules.scm
hyde263% ./test1
test2.scm
Error: undefined variable
foo
(package initial-system)
Undefined: (foo)
hyde264%
I begin to suspect the problem might be in make-scsh-image.scm which
(according to the manual) does a simple:
(run (| (begin
(format #t "(dump-scsh-program main \"~a\") (exit)" temp-file))
(scsh ,@args -lm ,source-file -o program))
(> /dev/null))
where args is '(-lm modules.scm) and source-file is test1.scm. Then
it adds
"#!/usr/local/lib/scsh/scshvm \\\n-o /usr/local/lib/scsh/scshvm -i\n!#\n"
to fix the header.
> WP> Wouldn't this hard code source.scm in the compiled code? (yes, I'm
> WP> generating scsh images for speed)
>
> Okay, I see. But the code of source.scm will only be compiled and
> stored in the image if you load/open the module SOURCE before you dump the
> image. Otherwise the compiler will not look into the module's code.
How would you delay the opening of SOURCE?
--
walter pelissero
http://www.pelissero.org
|