Mercurial > hg > xemacs-beta
changeset 2078:0bcc1e4dfd91
[xemacs-hg @ 2004-05-14 15:34:36 by james]
Add support for loading modules with LTDL, the libtool library.
author | james |
---|---|
date | Fri, 14 May 2004 15:34:40 +0000 |
parents | 8f6c15382b31 |
children | 9402c85dcf6f |
files | lib-src/config.values.in src/ChangeLog src/config.h.in src/emodules.c src/sysdll.c src/sysdll.h |
diffstat | 6 files changed, 71 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/lib-src/config.values.in Thu May 13 21:50:28 2004 +0000 +++ b/lib-src/config.values.in Fri May 14 15:34:40 2004 +0000 @@ -44,6 +44,7 @@ INSTALL_SCRIPT "@INSTALL_SCRIPT@" LDFLAGS "@LDFLAGS@" LIBS "@LIBS@" +LIBSTDCPP "@LIBSTDCPP@" LISPDIR "@LISPDIR@" LISPDIR_USER_DEFINED "@LISPDIR_USER_DEFINED@" LN_S "@LN_S@" @@ -72,6 +73,7 @@ SRC_SUBDIR_DEPS "@SRC_SUBDIR_DEPS@" SUBDIR_MAKEFILES "@SUBDIR_MAKEFILES@" XEMACS_CC "@XEMACS_CC@" +XE_CFLAGS "@XE_CFLAGS@" X_CFLAGS "@X_CFLAGS@" X_EXTRA_LIBS "@X_EXTRA_LIBS@" X_LIBS "@X_LIBS@"
--- a/src/ChangeLog Thu May 13 21:50:28 2004 +0000 +++ b/src/ChangeLog Fri May 14 15:34:40 2004 +0000 @@ -1,3 +1,11 @@ +2004-05-10 Jerry James <james@xemacs.org> + + * config.h.in: Add HAVE_LTDL. + * emodules.c: Include LTDL headers, if needed. + * emodules.c (vars_of_module): Add LTDL initialization code. + * sysdll.c: Remove unused dll_init functions. Add LTDL support. + * sysdll.h: Remove dll_init declaration and adjust spacing. + 2004-05-05 Chuck Hines <chuck.hines@baesystems.com> * dgif_lib.c (DGifSlurp): Changed do-while to while to stop
--- a/src/config.h.in Thu May 13 21:50:28 2004 +0000 +++ b/src/config.h.in Fri May 14 15:34:40 2004 +0000 @@ -306,6 +306,7 @@ #undef HAVE__DLERROR #undef HAVE_SHL_LOAD #undef HAVE_DYLD +#undef HAVE_LTDL #undef DLSYM_NEEDS_UNDERSCORE #undef HAVE_SHLIB
--- a/src/emodules.c Thu May 13 21:50:28 2004 +0000 +++ b/src/emodules.c Fri May 14 15:34:40 2004 +0000 @@ -20,6 +20,9 @@ #include "emodules.h" #include "sysdll.h" +#ifdef HAVE_LTDL +#include <ltdl.h> +#endif /* Load path */ static Lisp_Object Vmodule_load_path; @@ -587,6 +590,13 @@ reinit_vars_of_module (); +#ifdef HAVE_LTDL + lt_dlinit (); + lt_dlmalloc = (lt_ptr (*) (size_t)) xmalloc; + lt_dlrealloc = (lt_ptr (*) (lt_ptr, size_t)) xrealloc; + lt_dlfree = (void (*) (lt_ptr)) xfree_1; +#endif + DEFVAR_LISP ("module-version", &Vmodule_version /* Emacs dynamic loading mechanism version, as a string.
--- a/src/sysdll.c Thu May 13 21:50:28 2004 +0000 +++ b/src/sysdll.c Fri May 14 15:34:40 2004 +0000 @@ -62,12 +62,6 @@ # endif #endif -int -dll_init (const Extbyte *arg) -{ - return 0; -} - dll_handle dll_open (Lisp_Object fname) { @@ -121,12 +115,6 @@ #elif defined(HAVE_SHL_LOAD) /* This is the HP/UX version */ #include <dl.h> -int -dll_init (const Extbyte *arg) -{ - return 0; -} - dll_handle dll_open (Lisp_Object fname) { @@ -184,12 +172,6 @@ #include "syswindows.h" #include "sysfile.h" -int -dll_init (const Extbyte *arg) -{ - return 0; -} - dll_handle dll_open (Lisp_Object fname) { @@ -238,12 +220,6 @@ #include <mach-o/dyld.h> -int -dll_init (const Extbyte *arg) -{ - return 0; -} - dll_handle dll_open (Lisp_Object fname) { @@ -451,14 +427,53 @@ NSLinkEditError(&c, &errorNumber, &fileNameWithError, &errorString); return build_ext_string (errorString, Qnative); } +#elif HAVE_LTDL +/* Libtool's libltdl */ +#include <ltdl.h> + +dll_handle +dll_open (Lisp_Object fname) +{ + Extbyte *soname; + + if (NILP (fname)) + { + soname = NULL; + } + else + { + LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + } + return (dll_handle) lt_dlopen (soname); +} + +int +dll_close (dll_handle h) +{ + return lt_dlclose ((lt_dlhandle) h); +} + +dll_func +dll_function (dll_handle h, const CIbyte *n) +{ + MAYBE_PREPEND_UNDERSCORE (n); + return (dll_func) lt_dlsym ((lt_dlhandle) h, n); +} + +dll_var +dll_variable (dll_handle h, const CIbyte *n) +{ + MAYBE_PREPEND_UNDERSCORE (n); + return (dll_var) lt_dlsym ((lt_dlhandle) h, n); +} + +Lisp_Object +dll_error () +{ + return build_ext_string (lt_dlerror (), Qnative); +} #else /* Catchall if we don't know about this system's method of dynamic loading */ -int -dll_init (const Extbyte *arg) -{ - return -1; -} - dll_handle dll_open (Lisp_Object fname) {
--- a/src/sysdll.h Thu May 13 21:50:28 2004 +0000 +++ b/src/sysdll.h Fri May 14 15:34:40 2004 +0000 @@ -28,13 +28,11 @@ typedef void * dll_func; typedef void * dll_var; -extern int dll_init(const Extbyte *); -extern int dll_shutdown(void); -extern dll_handle dll_open(Lisp_Object); -extern int dll_close(dll_handle); -extern dll_func dll_function(dll_handle, const CIbyte *); -extern dll_var dll_variable(dll_handle, const CIbyte *); -extern Lisp_Object dll_error(void); +extern dll_handle dll_open (Lisp_Object); +extern int dll_close (dll_handle); +extern dll_func dll_function (dll_handle, const CIbyte *); +extern dll_var dll_variable (dll_handle, const CIbyte *); +extern Lisp_Object dll_error (void); /* More stand-ins ... */