diff --git a/pkgs/racket-doc/scribblings/raco/c-mods.scrbl b/pkgs/racket-doc/scribblings/raco/c-mods.scrbl index a6ef24eee2..1e6f362f6e 100644 --- a/pkgs/racket-doc/scribblings/raco/c-mods.scrbl +++ b/pkgs/racket-doc/scribblings/raco/c-mods.scrbl @@ -24,3 +24,31 @@ Normally, @nonterm{dir} is a relative path, and files are found at run time in @nonterm{dir} relative to the executable, but a separate path (usually relative) for run time can be specified with @DFlag{runtime-access}. + + +Typically, @exec{raco ctool --c-mods} is used with @DPFlag{lib} to +specify a collection-based module path. For example, + +@commandline{raco ctool --c-mods base.c ++lib racket/base} + +generates a @filepath{base.c} whose @tt{declare_modules} function +makes @racketmodname[racket/base] available for use via the +@tt{scheme_namespace_require} or @tt{scheme_dynamic_require} functions +within the embedding application. + +When a module file is provided to @exec{raco ctool --c-mods}, then +@tt{declare_modules} declares a module with the symbolic name of the +module file. For example, + +@commandline{raco ctool --c-mods base.c hello.rkt} + +creates a @tt{declare_modules} that defines the module +@racket['hello], which could be required into the current namespace +with @racket[(namespace-require ''hello)] or similarly at the C level: + +@verbatim[#:indent 2]{ + p = scheme_make_pair(scheme_intern_symbol("quote"), + scheme_make_pair(scheme_intern_symbol("hello"), + scheme_make_null())); + scheme_namespace_require(p); +}