[plt-scheme] namespace mismatch using eval in embedded interpreter
Hello,
I need a little help calling mzscheme's eval in a compiled executable.
Here is the program in question :
;; test.scm
#lang scheme
(define (say-hello)
(display "hello"))
(define-namespace-anchor my-anchor)
(define (main)
(eval (read)
(namespace-anchor->namespace my-anchor)))
(provide main)
I can use it like this :
>mzscheme
Welcome to MzScheme v4.2.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
> (require (file "test.scm"))
> (main)
(say-hello)
hello> ^Z
The problem is I can't find the right incantation to compile test.scm.
Here is what I tried :
;; compile-test.scm
#lang scheme
(require compiler/embed)
(require setup/dirs)
(create-embedding-executable
"allo.exe"
#:modules '( (#f "test.scm"))
#:cmdline '("-e" "(main)")
#:collects-path (find-collects-dir)
)
But there must be something missing because I get :
>mzscheme compile-test.scm
>allo.exe
require: namespace mismatch; reference (phase 0) to a module
'#%embedded:g166:kw that is not available (phase level 0) in: #%app
I also tried using mzc.exe with similar problems.
Any help would be appreciated, thanks.
--
Marc-Antoine Desroches
http://www.vlam.ca
http://foobrac.blogspot.com/