Node:Accessing Modules from C, Previous:Included Guile Modules, Up:The Guile module system
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.
SCM scm_current_module () | C Procedure |
Return the module that is the current module. |
SCM scm_set_current_module (SCM module) | C Procedure |
Set the current module to module and return the previous current module. |
SCM scm_c_call_with_current_module (SCM module, SCM (*func)(void *), void *data) | C Procedure |
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.
|
SCM scm_c_lookup (const char *name) | C Procedure |
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. |
SCM scm_lookup (SCM name) | C Procedure |
Like scm_c_lookup , but the symbol is specified directly.
|
SCM scm_c_module_lookup (SCM module, const char *name) | C Procedure |
SCM scm_module_lookup (SCM module, SCM name) | C Procedure |
Like scm_c_lookup and scm_lookup , but the specified
module is used instead of the current one.
|
SCM scm_c_define (const char *name, SCM val) | C Procedure |
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. |
SCM scm_define (SCM name, SCM val) | C Procedure |
Like scm_c_define , but the symbol is specified directly.
|
SCM scm_c_module_define (SCM module, const char *name, SCM val) | C Procedure |
SCM scm_module_define (SCM module, SCM name, SCM val) | C Procedure |
Like scm_c_define and scm_define , but the specified
module is used instead of the current one.
|
SCM scm_module_reverse_lookup (SCM module, SCM variable) | C Procedure |
Find the symbol that is bound to variable in module. When no such binding is found, return #f. |
SCM scm_c_define_module (const char *name, void (*init)(void *), void *data) | C Procedure |
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, When there already exists a module named name, it is used unchanged, otherwise, an empty module is created. |
SCM scm_c_resolve_module (const char *name) | C Procedure |
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 .
|
SCM scm_resolve_module (SCM name) | C Procedure |
Like scm_c_resolve_module , but the name is given as a real list
of symbols.
|
SCM scm_c_use_module (const char *name) | C Procedure |
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 .
|
SCM scm_c_export (const char *name, ...) | C Procedure |
Add the bindings designated by name, ... to the public interface
of the current module. The list of names is terminated by
NULL .
|