* dynl.c: Use ANSI prototypes.
authorMarius Vollmer <mvo@zagadka.de>
Mon, 10 Jan 2000 00:36:26 +0000 (00:36 +0000)
committerMarius Vollmer <mvo@zagadka.de>
Mon, 10 Jan 2000 00:36:26 +0000 (00:36 +0000)
(sysdep_dynl_link): Use lt_dlopenext instead of lt_dlopen.
* dynl.c: use libltdl if DYNAMIC_LINKING is enabled,

libguile/dynl.c

index 88556a1..1e75800 100644 (file)
@@ -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. */
 
@@ -279,8 +317,6 @@ sysdep_dynl_func (const char *symbol,
     return NULL;
 }
 
-#endif
-#endif
 #endif
 
 int scm_tc16_dynamic_obj;