@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
-@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2010
+@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2010, 2011
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
the beginning which tells the operating system how to invoke Guile, and
then tells Guile how to handle the Scheme code.
-Here is a trivial Guile script, for more details @xref{Guile Scripting}.
+Here is a trivial Guile script. @xref{Guile Scripting}, for more details.
@example
#!/usr/local/bin/guile -s
@example
$ gcc -o simple-guile simple-guile.c \
- `pkg-config --cflags --libs guile-2.0`
+ `pkg-config --cflags --libs guile-@value{EFFECTIVE-VERSION}`
@end example
When it is run, it behaves just like the @code{guile} program except
users of your program. You can also link your library into Guile and
make its functionality available to all users of Guile.
-A library that is linked into Guile is called an @dfn{extensions}, but
-it really just is an ordinary object library.
+A library that is linked into Guile is called an @dfn{extension}, but it
+really just is an ordinary object library.
The following example shows how to write a simple extension for Guile
that makes the @code{j0} function available to Scheme code.
how to do it on GNU/Linux:
@smallexample
-gcc -shared -o libguile-bessel.so -fPIC bessel.c
+gcc `pkg-config --cflags guile-@value{EFFECTIVE-VERSION}` \
+ -shared -o libguile-bessel.so -fPIC bessel.c
@end smallexample
For creating shared libraries portably, we recommend the use of GNU
$1 = 0.223890779141236
@end smallexample
+For more on how to install your extension, @pxref{Installing Site
+Packages}.
+
@node Using the Guile Module System
@subsection Using the Guile Module System
session shows a simple example.
@smallexample
-$ cat /usr/local/share/guile/foo/bar.scm
+$ cat /usr/local/share/guile/site/foo/bar.scm
(define-module (foo bar)
#:export (frob))
$1 = 24
@end smallexample
+For more on how to install your module, @pxref{Installing Site
+Packages}.
+
+
@node Putting Extensions into Modules
@subsubsection Putting Extensions into Modules
call @code{load-extension} directly in the body of the module.
@smallexample
-$ cat /usr/local/share/guile/math/bessel.scm
+$ cat /usr/local/share/guile/site/math/bessel.scm
(define-module (math bessel)
#:export (j0))
(load-extension "libguile-bessel" "init_bessel")
-$ file /usr/local/lib/libguile-bessel.so
+$ file /usr/local/lib/guile/@value{EFFECTIVE-VERSION}/extensions/libguile-bessel.so
@dots{} ELF 32-bit LSB shared object @dots{}
$ guile
scheme@@(guile-user)> (use-modules (math bessel))
@example
$ ./config.status --config
-'--enable-error-on-warning' '--disable-deprecated' '--prefix=/opt/guile' '--libdir=/opt/guile/lib64' 'CC=ccache gcc'
+'--enable-error-on-warning' '--disable-deprecated'...
@end example
@item