▼ |  | mzc: PLT Compilation and Packaging

1 | Running mzc
2 | Compiling Modified Modules to Bytecode
3 | Creating and Distributing Stand-Alone Executables
4 | Packaging Library Collections
5 | Compiling and Linking C Extensions
6 | Embedding Scheme Modules via C
7 | Decompiling Bytecode
8 | Compiling to Raw Bytecode
9 | Compiling to Native Code via C
10 | Scheme API for Compilation
| Index

top ← prev up next →

### 9`` Compiling to Native Code via C

The --extension/-e mode for mzc is similar to the --zo mode, except that the compiled form of the module is a native-code shared library instead of bytecode. Native code is generated with the help of the host system’s C compiler. This mode is rarely useful, because the just-in-time (JIT) compiler that is built into PLT Scheme provides better performance with lower overhead on the platforms where it is supported (see Performance).

As with --zo mode, the generated shared library by default is placed in the same directory as the source file – which is not where it will be found automatically when loading the source. Use the --auto-dir flag to redirect the output to a (build-path "compiled" "native" (system-library-subpath)) subdirectory, where it will be found automatically when loading the source file.

The --c-source/-c mode for mzc is like the --extension/-e mode, except that compilation stops with the generation of C code.

All of the C compiler and linker flags that apply to --cc and --ld mode also apply to --extension mode; see Compiling and Linking C Extensions. In addition, a few flag provide some control over the Scheme-to-C compiler: --no-prop, --inline, --no-prim, --stupid, --unsafe-disable-interrupts, --unsafe-skip-tests, and --unsafe-fixnum-arithmetic. Use mzc --help for an explanation of each flag.

top ← prev up next →