DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(guile.info.gz) Accessing Modules from C

Info Catalog (guile.info.gz) Included Guile Modules (guile.info.gz) The Guile module system
 
 31.3.6 Accessing Modules from C
 -------------------------------
 
 The last sections have described how modules are used in Scheme code,
 which is the recommended way of creating and accessing modules.  You
 can also work with modules from C, but it is more cumbersome.
 
    The following procedures are available.
 
  -- C Procedure: SCM scm_current_module ()
      Return the module that is the _current module_.
 
  -- C Procedure: SCM scm_set_current_module (SCM MODULE)
      Set the current module to MODULE and return the previous current
      module.
 
  -- C Procedure: SCM scm_c_call_with_current_module (SCM MODULE, SCM
           (*FUNC)(void *), void *DATA)
      Call FUNC and make MODULE the current module during the call.  The
      argument DATA is passed to FUNC.  The return value of
      `scm_c_call_with_current_module' is the return value of FUNC.
 
  -- C Procedure: SCM scm_c_lookup (const char *NAME)
      Return the variable bound to the symbol indicated by NAME in the
      current module.  If there is no such binding or the symbol is not
      bound to a variable, signal an error.
 
  -- C Procedure: SCM scm_lookup (SCM NAME)
      Like `scm_c_lookup', but the symbol is specified directly.
 
  -- C Procedure: SCM scm_c_module_lookup (SCM MODULE, const char *NAME)
  -- C Procedure: SCM scm_module_lookup (SCM MODULE, SCM NAME)
      Like `scm_c_lookup' and `scm_lookup', but the specified module is
      used instead of the current one.
 
  -- C Procedure: SCM scm_c_define (const char *NAME, SCM VAL)
      Bind the symbol indicated by NAME to a variable in the current
      module and set that variable to VAL.  When NAME is already bound
      to a variable, use that.  Else create a new variable.
 
  -- C Procedure: SCM scm_define (SCM NAME, SCM VAL)
      Like `scm_c_define', but the symbol is specified directly.
 
  -- C Procedure: SCM scm_c_module_define (SCM MODULE, const char *NAME,
           SCM VAL)
  -- C Procedure: SCM scm_module_define (SCM MODULE, SCM NAME, SCM VAL)
      Like `scm_c_define' and `scm_define', but the specified module is
      used instead of the current one.
 
  -- C Procedure: SCM scm_module_reverse_lookup (SCM MODULE, SCM
           VARIABLE)
      Find the symbol that is bound to VARIABLE in MODULE.  When no such
      binding is found, return #F.
 
  -- C Procedure: SCM scm_c_define_module (const char *NAME, void
           (*INIT)(void *), void *DATA)
      Define a new module named NAME and make it current while INIT is
      called, passing it DATA.  Return the module.
 
      The parameter NAME is a string with the symbols that make up the
      module name, separated by spaces.  For example, `"foo bar"' names
      the module `(foo bar)'.
 
      When there already exists a module named NAME, it is used
      unchanged, otherwise, an empty module is created.
 
  -- C Procedure: SCM scm_c_resolve_module (const char *NAME)
      Find the module name NAME and return it.  When it has not already
      been defined, try to auto-load it.  When it can't be found that
      way either, create an empty module.  The name is interpreted as
      for `scm_c_define_module'.
 
  -- C Procedure: SCM scm_resolve_module (SCM NAME)
      Like `scm_c_resolve_module', but the name is given as a real list
      of symbols.
 
  -- C Procedure: SCM scm_c_use_module (const char *NAME)
      Add the module named NAME to the uses list of the current module,
      as with `(use-modules NAME)'.  The name is interpreted as for
      `scm_c_define_module'.
 
  -- C Procedure: SCM scm_c_export (const char *NAME, ...)
      Add the bindings designated by NAME, ... to the public interface
      of the current module.  The list of names is terminated by `NULL'.
 
Info Catalog (guile.info.gz) Included Guile Modules (guile.info.gz) The Guile module system
automatically generated byinfo2html