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 Compiling to Raw Bytecode
8 Compiling to Native Code via C
9 Scheme API for Compilation
Index
Version: 4.0.2

 

5 Compiling and Linking C Extensions

A dynamic extension is a shared library (a.k.a. DLL) that extends PLT Scheme using the C API. An extension can be loaded explicitly via load-extension, or it can be loaded implicitly through require or load/use-compiled in place of a source file when the extension is located at

  (build-path "compiled" "native" (system-library-subpath)

              (path-add-suffix file (system-type 'so-suffix)))

relative to file.

For information on writing extensions, see Inside: PLT Scheme C API.

Three mzc modes help for building extensions:

Compilation and linking build on the dynext/compile and dynext/link libraries. The following mzc flags correspond to setting or accessing parameters for those libraries: --tool, --compiler, --ccf, --ccf, --ccf-clear, --ccf-show, --linker, ++ldf, --ldf, --ldf-clear, --ldf-show, ++ldl, --ldl-show, ++cppf, ++cppf ++cppf-clear, and --cppf-show.

The --3m flag specifies that the extension is to be loaded into the 3m variant of PLT Scheme. The --cgc flag specifies that the extension is to be used with the CGC. The default depends on mzc: --3m if mzc itself is running in 3m, --cgc if mzc itself is running in CGC.