[plt-scheme] Embedded MzScheme

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jun 29 08:27:20 EDT 2008

At Sat, 28 Jun 2008 14:13:35 -0500, "Mike Slegeir" wrote:
> I'm trying to embed MzScheme into a C program.  I have some basic code
> running in there; however, the code I'd like to use uses define-macro, and
> this seems to present a problem.  I would like to be able to embed
> defmacro.ss along with scheme/base and mzscheme via mzc (and load those via
> declare_modules in C).  However, I can not figure out how I'm supposed to
> 'require' a module from the embedded modules.  Any suggestions as to how I
> can accomplish this?

The copy of the modules set up by `mzc --c-mods' preserves the modules
original collection-based paths, so you can `require' the embedded
modules as if they were still installed as a collection.

After calling declare_modules(), the simplest way to `require' the
module `mzlib/defmacro' into the current namespace is to use
scheme_namespace_require(), like this:

  scheme_namespace_require(scheme_intern_symbol("mzlib/defmacro"))

which is the same as the call

  (namespace-require 'mzlib/defmacro)

in Scheme.


Matthew



Posted on the users mailing list.