[plt-scheme] Namespace in compiled executable

From: Yannick Scherer (Yannick_Scherer at gmx.net)
Date: Wed Jun 2 09:35:43 EDT 2004

Matthew Flatt wrote:
> At Tue, 1 Jun 2004 13:00:26 +0200, "Yannick Scherer" wrote:
> > (module test mzscheme
> >
> >     (define mred-namespace (make-namespace-with-mred 'mred))
> >
> >     (parameterize ([current-namespace mred-namespace])
> >         (eval '(require (lib "mred.ss" "mred"))))
> > )
> >
> > It works fine inside DrScheme, but compiling the file with
> >     mzc --gui-exe "test.exe" "test.scm"
> >
> > and executing "test.exe" results in the following error:
> >     dynamic-require: unknown module: %mred-kernel
> >
> > Could anybody tell me, why it doesn't work?
>
> Ok, I understand better, now. The exp-tagged code in CVS is improved,
> but there are still limitations.
>
> The problem is the interaction of namespaces and embedded modules. In a
> stand-alone executable, paths such as `(lib "mred.ss" "mred")' are
> mapped to embedded modules, but only in the initial namespace.
>
> The `make-namespace-with-mred' function can still work, and that's the
> improvement now in CVS.
>
> But the `(eval '(require (lib "mred.ss" "mred")))' above won't work.
> Possibly you don't need it, since `make-namespace-with-mred' already
> requires the MrEd module into the namespace that it creates.
>
> If you're using v207 instead of v207.1 (nightly build or from CVS),
> then you can patch MrEd by modifying plt/collects/mred/mred.ss. Replace
> the definition of `make-namespace-with-mred' with the code below, then
> run Setup PLT.
>
> Matthew
>
> ----------------------------------------
> ...

>

Thanks. The old problem doesn't exist any more, but there's a new one: If I
execute a
`(require (lib ...))'-statement in the new namespace, my program can't find
the collection paths.

So I moved the `collects' directory (of DrScheme) to my program's path and
tried again. Now the namespace is trying to load "class.ss", but it can't
find the subdirectory `private' of `mzlib' (where it searchs for
"class-sneaky.ss"), because it looks for it in my program's directory. The
error:

    current-load-relative-directory: [...] directory does not exist: "<my
program's path>/private"

It searches at the wrong location, you see.

Could you help me again?

Yannick



Posted on the users mailing list.