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:
parent
a6be01a45e
commit
95a62aedd8
1 changed files with 45 additions and 9 deletions
|
@ -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
|
||||
@node What is Guile?
|
||||
|
@ -63,7 +63,7 @@ used.
|
|||
* Guile Scripts::
|
||||
* Linking Programs With Guile::
|
||||
* Writing Extensions for Guile::
|
||||
* Writing Guile Modules::
|
||||
* Guile Modules::
|
||||
@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
|
||||
module system, see below REFFIXME.
|
||||
|
||||
@node Writing Guile Modules
|
||||
@section Writing Guile Modules
|
||||
@node Guile Modules
|
||||
@section Guile Modules
|
||||
|
||||
Guile has support for dividing a program into @dfn{modules}. By using
|
||||
modules, you can group related code together and manage the composition
|
||||
of complete programs from their largely independent parts.
|
||||
modules, you can group related code together and manage the
|
||||
composition of complete programs from largely independent parts.
|
||||
|
||||
(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
|
||||
provide reasonable backwards compatability.)
|
||||
|
||||
[[ more stuff to follow: how to load third-party modules, how to write
|
||||
new modules, how to arrange for autoloading, how to load shared
|
||||
libraries as modules. ]]
|
||||
@menu
|
||||
* Using Guile 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
|
||||
@node Reporting Bugs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue