Node:Creating Guile Modules,
Next:Module System Quirks,
Previous:Using Guile Modules,
Up:The Guile module system
31.3.3 Creating Guile Modules
When you want to create your own modules, you have to take the following
- Create a Scheme source file and add all variables and procedures you wish
to export, or which are required by the exported procedures.
- Add a
define-module form at the beginning.
- Export all bindings which should be in the public interface, either
export (both documented below).
|define-module module-name [options ...]
module-name is of the form |
(hierarchy file). One
example of this is
(define-module (ice-9 popen))
define-module makes this module available to Guile programs under
the given module-name.
The options are keyword/value pairs which specify more about the
defined module. The recognized options and their meaning is shown in
the following table.
- Equivalent to a
(see Using Guile Modules).
- Use module when loading the currently defined module, and install
it as the syntax transformer.
#:autoload module symbol
- Load module whenever symbol is accessed.
- Export all identifiers in list, which must be a list of symbols.
This is equivalent to
(export list) in the module body.
- Tell Guile not to record information for procedure backtraces when
executing the procedures in this module.
- Create a pure module, that is a module which does not contain any
of the standard procedure bindings except for the syntax forms. This is
useful if you want to create safe modules, that is modules which
do not know anything about dangerous procedures.
|export variable ...
Add all variables (which must be symbols) to the list of exported
bindings of the current module.
Equivalent to |
(begin (define foo ...) (export foo)).