[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Loading Guile `Extensions'
From: |
Marius Vollmer |
Subject: |
Loading Guile `Extensions' |
Date: |
20 May 2001 03:07:27 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102 |
Hi,
what about adding this to Guile and making it the recommended way to
load extensions aka shared libraries?
- C: scm_register_extension (const char *LIB, const char *INIT,
void (*FUNC)())
Register FUNC as a initialization function for LIB/INIT.
- Scheme: load-extension LIB INIT
Load and initilize the extension designated by LIB and INIT. When
there is no pre-registered function for LIB/INIT, this
is equivalent to
(dynamic-call INIT (dynamic-link LIB))
When there is a pre-registered function, that function is called
instead.
Normally, there is no pre-registered function. This option exists
only for situations where dynamic linking is unavailable or
unwanted. In that case, you would statically link your program
with the desired library, and register its init function right
after Guile has been initialized.
LIB should be a string denoting a shared library without any file
type suffix such as ".so". The suffix is provided automatically.
It should also not contain any directory components. Libraries
that implement Guile Extensions should be put into the normal
locations for shared libraries. We recommend to use the naming
convention libguile-bla-blum for a extension related to a module
`(bla blum)'.
The normal way for a extension to be used is to write a small
Scheme file that defines a module, and to load the extension into
this module. When the module is auto-loaded, the extension is
loaded as well. For example,
(define-module (bla blum))
(load-extension "libguile-bla-blum" "bla_init_blum")
- Loading Guile `Extensions',
Marius Vollmer <=