diff options
author | Marius Vollmer <mvo@zagadka.de> | 2000-01-10 00:36:26 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2000-01-10 00:36:26 +0000 |
commit | 4feb69af5a780a6a7fde68f04bff593364a95fa1 (patch) | |
tree | e1caa763b9bc7abe94256733143e379c59f222aa /libguile/dynl.c | |
parent | 6165ede38b4cfd18ee9530505f7a2cb5d5dc58e7 (diff) | |
download | guile-4feb69af5a780a6a7fde68f04bff593364a95fa1.tar.gz |
* dynl.c: Use ANSI prototypes.
(sysdep_dynl_link): Use lt_dlopenext instead of lt_dlopen.
* dynl.c: use libltdl if DYNAMIC_LINKING is enabled,
Diffstat (limited to 'libguile/dynl.c')
-rw-r--r-- | libguile/dynl.c | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/libguile/dynl.c b/libguile/dynl.c index 88556a1a6..1e7580037 100644 --- a/libguile/dynl.c +++ b/libguile/dynl.c @@ -230,15 +230,53 @@ only by module bookkeeping operations.") #define DYNL_GLOBAL 0x0001 -#ifdef HAVE_DLOPEN -#include "dynl-dl.c" -#else -#ifdef HAVE_SHL_LOAD -#include "dynl-shl.c" +#ifdef DYNAMIC_LINKING + +#include <ltdl.h> + +static void * +sysdep_dynl_link (const char *fname, int flags, const char *subr) +{ + lt_dlhandle handle = lt_dlopenext (fname); + if (NULL == handle) + { + SCM_ALLOW_INTS; + scm_misc_error (subr, (char *)lt_dlerror (), SCM_EOL); + } + return (void *) handle; +} + +static void +sysdep_dynl_unlink (void *handle, const char *subr) +{ + if (lt_dlclose ((lt_dlhandle) handle)) + { + SCM_ALLOW_INTS; + scm_misc_error (subr, (char *)lt_dlerror (), SCM_EOL); + } +} + +static void * +sysdep_dynl_func (const char *symb, void *handle, const char *subr) +{ + void *fptr; + + fptr = lt_dlsym ((lt_dlhandle) handle, symb); + if (!fptr) + { + SCM_ALLOW_INTS; + scm_misc_error (subr, (char *)lt_dlerror (), SCM_EOL); + } + return fptr; +} + +static void +sysdep_dynl_init () +{ + lt_dlinit (); +} + #else -#ifdef HAVE_LIBDLD -#include "dynl-dld.c" -#else /* no dynamic linking available, throw errors. */ @@ -280,8 +318,6 @@ sysdep_dynl_func (const char *symbol, } #endif -#endif -#endif int scm_tc16_dynamic_obj; |