Ah, now I know what is going on. You are using `dump-scsh-program'
(or, equivalently ,build) to write the image, while I was using
,dump. The difference is that ,dump automatically includes the
command interpreter while `dump-scsh-program' does not. Both
,user-package-is and `get-package' depend on the command interpreter.
The following works because it bypasses the command interpreter
by using the lower-level procedure `with-interaction-environment'.
% ./scshvm -i scsh/scsh.image
Scsh 0.4
> ,open environments package-commands-internal
> ,config (define-structure test (export)
(open scheme)
(begin (define bar 10)))
> (let ((env (get-package 'test)))
(dump-scsh-program
(lambda ignore
(with-interaction-environment env
(lambda ()
(load "test.scm")))) ; prints out the value of `bar'
"test.image"))
Load structure test (y/n)? y
[test
.
]
Writing test.image
#t
> ,exit
% ./scshvm -i test.image
test.scm
bar = 10
%
I will track down the code responsible for the original
Error: exception
(record-ref #f 3)
message and have it produce somthing more perspicacious.
-Richard
|