[plt-scheme] embedding MzScheme v4

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Apr 23 08:51:04 EDT 2008

In MzScheme v372 an earlier, the `mzscheme' module (i.e., everything
documented in the MzScheme reference manual) was part of the
executable. Some of it was implemented in Scheme, but the bytecode form
of the implementation was stored as a static byte array in the

In MzScheme v4 (and v3.99), the Scheme code implementing `mzscheme' has
been moved out of the executable and into the main "collects" tree.
That way, when you run a program built on the `scheme/base' module, you
don't have to load the `mzscheme' module at all, and vice-versa. (Those
two share a lot of the same code, but not all of it.)

Moving bytecode out of the executable adds some complexity to the
process of embedding PLT Scheme into a larger program. There are two

 * Call scheme_set_collects_path() and scheme_init_collection_path() in
   the embedding program to install a path to a "collects" directory at
   run time.

 * Use `mzc --c-mods' to convert a set of modules into embeddable C
   code (as a static byte array that contains bytecode).

For more details, see


An advantage of this change is that the author of an embedding
executable can pick the modules that are built into the executable. You
might embed `mzscheme', `scheme/base', both of those, `scheme', or your
own initial module. (In v372, there wasn't any particular support for
combining your own modules into the executable.)

If you have an application that embeds PLT Scheme, consider upgrading
to v3.99.0.23 to try out the new tools:


We're nearing a v4 release, and feedback on the new organization would
be especially helpful before the release.


Posted on the users mailing list.