1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 12:20:20 +02:00

Replace libltdl with raw dlopen, dlsym

* NEWS: Update.
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Add system/foreign-library.scm.
* configure.ac: Replace ltdl check with -ldl check.
* libguile/dynl.c: Rewrite to just expose core dlopen / dlsym / etc to a
  helper Scheme module.
  (scm_dynamic_link, scm_dynamic_pointer, scm_dynamic_function)
  (scm_dynamic_object_p, scm_dynamic_call): Rewrite in terms of (system
  foreign-library).
* libguile/extensions.c (load_extension): Avoid scm_dynamic_call.
* module/system/foreign-library.scm: New file.
* module/oop/goops.scm (<dynamic-object>): Hackily export
  <foreign-library> instead of a class here.
* doc/ref/api-foreign.texi (Foreign Function Interface): Rewrite to only
  document the new interfaces.  Eventually we will deprecate
  dynamic-link and friends.
* doc/ref/guile.texi (API Reference): Move Foreign Objects after Foreign
  Function Interface.  Seems there should be some closer relationship
  but this will do for now.
* doc/ref/tour.texi (Putting Extensions into Modules):
* doc/ref/libguile-parallel.texi (Parallel Installations): Update for
  rename of Modules and Extensions to Foreign Extensions.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_dynamic_unlink): Deprecate.
* libguile/guile.c: Remove ltdl include.
* test-suite/tests/foreign.test: Update tests to use new API, and update
  error expectations.
This commit is contained in:
Andy Wingo 2021-01-22 16:39:11 +01:00
parent 480d86df68
commit 2e26538d6a
17 changed files with 934 additions and 911 deletions

View file

@ -1,4 +1,4 @@
/* Copyright 2001,2002,2004,2006,2009-2011,2018-2019
/* Copyright 2001,2002,2004,2006,2009-2011,2018-2019,2021
Free Software Foundation, Inc.
This file is part of Guile.
@ -27,6 +27,7 @@
#include "dynwind.h"
#include "gc.h"
#include "gsubr.h"
#include "foreign.h"
#include "strings.h"
#include "threads.h"
@ -113,7 +114,9 @@ load_extension (SCM lib, SCM init)
/* Dynamically link the library. */
#if HAVE_MODULES
scm_dynamic_call (init, scm_dynamic_link (lib));
SCM pointer = scm_dynamic_pointer (init, scm_dynamic_link (lib));
void (*f)(void) = scm_to_pointer (pointer);
f ();
#else
scm_misc_error ("load-extension",
"extension ~S:~S not registered and dynamic-link disabled",