Node:Creating Guile Modules, Next:, 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 steps:

define-module module-name [options ...] syntax
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.

#:use-module interface-specification
Equivalent to a (use-modules interface-specification) (see Using Guile Modules).
#:use-syntax module
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 list
Export all identifiers in list, which must be a list of symbols. This is equivalent to (export list) in the module body.
#:no-backtrace
Tell Guile not to record information for procedure backtraces when executing the procedures in this module.
#:pure
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 ... syntax
Add all variables (which must be symbols) to the list of exported bindings of the current module.

define-public ... syntax
Equivalent to (begin (define foo ...) (export foo)).