12.2 Embedding Modules via C

The --c-mods mode for raco ctool takes a set of Racket modules and generates a C source file that can be used as part of program that embeds the Racket run-time system. See Embedding into a Program in Inside: Racket C API for an explanation of embedding programs.

The generated source file embeds the specified modules, and it defines a declare_modules function that puts the module declarations into a namespace. Thus, using the output of raco ctool --c-mods, a program can embed Racket with a set of modules so that it does not need a "collects" directory to load modules at run time.

If the embedded modules refer to runtime files, the files can be gathers by supplying the --runtime argument to raco ctool --cmods, specifying a directory dir to hold the files. Normally, dir is a relative path, and files are found at run time in dir relative to the executable, but a separate path (usually relative) for run time can be specified with --runtime-access.