Creating a stand-alone executable that embeds native code from mzc requires downloading the MzScheme source code and using a C compiler and linker directly.
To build an executable with an embedded MzScheme engine:
The preprocessor symbol causes MzScheme's startup code to skip command line parsing, the user's initialization file, and the read-eval-print loop. Instead, the C function scheme_initialize is called, which is the entry point into mzc-compiled Scheme code. After compiling main.c with STANDALONE_WITH_EMBEDDED_EXTENSION defined, MzScheme will not link by itself; it must be linked with objects produced by mzc.
Each of the Scheme source files in the program must have a different base name (i.e., the file name without its directory path or extension), otherwise _loader cannot distinguish them. The files need not reside in the same directory.
Under Unix, the Makefile distributed with MzScheme provides a target ee-app that performs the final linking step. To use the target, call mzmake with a definition for the makefile macro EEAPP to the output file name, and a definition for the makefile macro EEOBJECTS to to the list of mzc-created object files. (The example below demonstrates how to define makefile variables on the command line.)
For example, under Unix, to create a standalone executable MyApp that is equivalent to
mzscheme -mv -f file1.ss -f file2.ssunpack the MzScheme source code and perform the following steps:
cd plt/src/mzscheme ./mzmake ./mzmake ee-main mzc --object --embedded file1.ss mzc --object --embedded file2.ss mzc --link-glue --embedded file1.kp file1.o file2.kp file2.o ./mzmake EEAPP=MyApp EEOBJECTS="file1.o file2.o _loader.o" ee-app
To produce an executable that embeds the MrEd engine, the procedure is essentially the same. MrEd is compiled somewhat differently from MzScheme (e.g., there's no mzmake), and MrEd's main file is mred.cxx instead of main.c. See the compilation notes in the MrEd source code distribution for more information.