DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(guile.info.gz) Creating Guile Modules

Info Catalog (guile.info.gz) Using Guile Modules (guile.info.gz) The Guile module system (guile.info.gz) Module System Quirks
 
 31.3.3 Creating Guile Modules
 -----------------------------
 
 When you want to create your own modules, you have to take the following
 steps:
 
    * 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
      by using `define-public' or `export' (both documented below).
 
  -- syntax: 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.
 
     `#:use-module INTERFACE-SPECIFICATION'
           Equivalent to a `(use-modules INTERFACE-SPECIFICATION)'
           ( 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.
 
 
  -- syntax: export variable ...
      Add all VARIABLEs (which must be symbols) to the list of exported
      bindings of the current module.
 
  -- syntax: define-public ...
      Equivalent to `(begin (define foo ...) (export foo))'.
 
Info Catalog (guile.info.gz) Using Guile Modules (guile.info.gz) The Guile module system (guile.info.gz) Module System Quirks
automatically generated byinfo2html