Previous: Writing new Modules, Up: Using the Guile Module System Putting Extensions into Modules

In addition to Scheme code you can also put things that are defined in C into a module.

You do this by writing a small Scheme file that defines the module and call load-extension directly in the body of the module.

     $ cat /usr/local/share/guile/math/bessel.scm
     (define-module (math bessel))
     (export j0)
     (load-extension "libguile-bessel" "init_bessel")
     $ file /usr/local/lib/
     ... ELF 32-bit LSB shared object ...
     $ guile
     guile> (use-modules (math bessel))
     guile> (j0 2)

There is also a way to manipulate the module system from C but only Scheme files can be autoloaded. Thus, we recommend that you define your modules in Scheme.