[previous] [up] [next]     [index]
Next: Index Up: PLT mzc: MzScheme Compiler Previous: Macro and Elaboration-Time Libraries

Building a Stand-alone Native Code Executable

Since native code produced by mzc relies on MzScheme to provide all run-time support, there is no way to use mzc to obtain small stand-alone native code executables. However, the source code to MzScheme is available, so it is possible to produce a large stand-alone executable that contains an embedded copy of the MzScheme (or MrEd) run-time engine. This process requires using a C compiler and linker directly.

To build an executable with an embedded MzScheme engine:

For example, under Unix, to create a standalone executable MyApp that is equivalent to

  mzscheme -mv -f file1.ss -f file2.ss
unpack 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 --glue-extension --embedded file1.kp file1.o file2.kp file2.o 
  ./mzmake EEAPP=MyApp EEOBJECTS="file1.o file2.o _loader.o" 

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.


[previous] [up] [next]     [index]
Next: Index Up: PLT mzc: MzScheme Compiler Previous: Macro and Elaboration-Time Libraries

PLT