[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in find-and-link-dynamic-module
From: |
Marius Vollmer |
Subject: |
Re: Bug in find-and-link-dynamic-module |
Date: |
09 Jun 2001 18:27:17 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102 |
Thomas Wawrzinek <address@hidden> writes:
> When playing around with dynamically loadable modules written in
> pure C I found that on my Linux box guile tries to access weirdly
> named libraries (that do not exist), like libfoo.la.la or
> libfoo.so.la.
That code has been deprecated recently. Does it cause real problems
for you? If not, I'd rather not touch it.
What you should be doing instead is this (from NEWS):
** New concept of `Guile Extensions'.
A Guile Extension is just a ordinary shared library that can be linked
at run-time. We found it advantageous to give this simple concept a
dedicated name to distinguish the issues related to shared libraries
from the issues related to the module system.
*** New function: load-extension
Executing (load-extension lib init) is mostly equivalent to
(dynamic-call init (dynamic-link lib))
except when scm_register_extension has been called previously.
Whenever appropriate, you should use `load-extension' instead of
dynamic-link and dynamic-call.
*** New C function: scm_c_register_extension
This function registers a initialization function for use by
`load-extension'. Use it when you don't want specific extensions to
be loaded as shared libraries (for example on platforms that don't
support dynamic linking).
** Auto-loading of compiled-code modules is deprecated.
Guile used to be able to automatically find and link a shared
library to satisfy requests for a module. For example, the module
`(foo bar)' could be implemented by placing a shared library named
"foo/libbar.so" (or with a different extension) in a directory on the
load path of Guile.
This has been found to be too tricky, and is no longer supported. The
shared libraries are now called "extensions". You should now write a
small Scheme file that calls `load-extension' to load the shared
library and initialize it explicitely.
The shared libraries themselves should be installed in the usual
places for shared libraries, with names like "libguile-foo-bar".
For example, place this into a file "foo/bar.scm"
(define-module (foo bar))
(load-extension "libguile-foo-bar" "foobar_init")