1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-25 22:20:28 +02:00

* intro.texi (Modules and Extensions): Some short text about

dynamic libraries and modules.
This commit is contained in:
Marius Vollmer 2001-03-25 00:31:10 +00:00
parent a6be01a45e
commit 95a62aedd8

View file

@ -1,4 +1,4 @@
@c $Id: intro.texi,v 1.3 2001-03-23 16:16:15 ossau Exp $ @c $Id: intro.texi,v 1.4 2001-03-25 00:31:10 mvo Exp $
@page @page
@node What is Guile? @node What is Guile?
@ -63,7 +63,7 @@ used.
* Guile Scripts:: * Guile Scripts::
* Linking Programs With Guile:: * Linking Programs With Guile::
* Writing Extensions for Guile:: * Writing Extensions for Guile::
* Writing Guile Modules:: * Guile Modules::
@end menu @end menu
@ -688,20 +688,56 @@ directories listed in the @code{LTDL_LIBRRAY_PATH} environment variable.
To see how these Guile extensions via shared libraries relate to the To see how these Guile extensions via shared libraries relate to the
module system, see below REFFIXME. module system, see below REFFIXME.
@node Writing Guile Modules @node Guile Modules
@section Writing Guile Modules @section Guile Modules
Guile has support for dividing a program into @dfn{modules}. By using Guile has support for dividing a program into @dfn{modules}. By using
modules, you can group related code together and manage the composition modules, you can group related code together and manage the
of complete programs from their largely independent parts. composition of complete programs from largely independent parts.
(The module system is in flux, and will likely look very different in (The module system is in flux, and will likely look very different in
the future. Feel free to use the existing system anyway. Guile will the future. Feel free to use the existing system anyway. Guile will
provide reasonable backwards compatability.) provide reasonable backwards compatability.)
[[ more stuff to follow: how to load third-party modules, how to write @menu
new modules, how to arrange for autoloading, how to load shared * Using Guile Modules::
libraries as modules. ]] * Writing New Modules::
* Modules and Extensions::
@end menu
@node Using Guile Modules
@subsection Using Existing Modules
To be written.
@node Writing New Modules
@subsection Writing New Modules
To be written.
@node Modules and Extensions
@subsection Modules and Extensions
In addition to Scheme code you can also put new procedures and other
named features that are provided by an extension into a module.
You do this by writing a small Scheme file that defines the module.
That Scheme file in turn invokes @code{dynamic-link} and
@code{dynamic-call} as explained above to make the extension
available.
Suppose we want to put the Bessel function @code{j0} from the example
extension into a module called @code{(math bessel)}. We would have to
write a Scheme file with this contents
@smallexample
(define-module (math bessel))
(dynamic-call "init_bessel" (dynamic-link "libguile-bessel"))
@end smallexample
The file should of course be saved in the right place for autolading,
for example as @file{/usr/local/share/guile/math/bessel.scm}.
@page @page
@node Reporting Bugs @node Reporting Bugs