Mercurial > hg > xemacs-beta
comparison src/sysdll.c @ 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 | 91d4c8c65a0f |
children | 612eb81b76eb |
comparison
equal
deleted
inserted
replaced
2077:8f6c15382b31 | 2078:0bcc1e4dfd91 |
---|---|
60 # else | 60 # else |
61 # define RTLD_NOW 2 | 61 # define RTLD_NOW 2 |
62 # endif | 62 # endif |
63 #endif | 63 #endif |
64 | 64 |
65 int | |
66 dll_init (const Extbyte *arg) | |
67 { | |
68 return 0; | |
69 } | |
70 | |
71 dll_handle | 65 dll_handle |
72 dll_open (Lisp_Object fname) | 66 dll_open (Lisp_Object fname) |
73 { | 67 { |
74 Extbyte *soname; | 68 Extbyte *soname; |
75 | 69 |
119 } | 113 } |
120 | 114 |
121 #elif defined(HAVE_SHL_LOAD) | 115 #elif defined(HAVE_SHL_LOAD) |
122 /* This is the HP/UX version */ | 116 /* This is the HP/UX version */ |
123 #include <dl.h> | 117 #include <dl.h> |
124 int | |
125 dll_init (const Extbyte *arg) | |
126 { | |
127 return 0; | |
128 } | |
129 | |
130 dll_handle | 118 dll_handle |
131 dll_open (Lisp_Object fname) | 119 dll_open (Lisp_Object fname) |
132 { | 120 { |
133 Extbyte *soname; | 121 Extbyte *soname; |
134 | 122 |
181 | 169 |
182 #elif defined (WIN32_NATIVE) || defined (CYGWIN) | 170 #elif defined (WIN32_NATIVE) || defined (CYGWIN) |
183 | 171 |
184 #include "syswindows.h" | 172 #include "syswindows.h" |
185 #include "sysfile.h" | 173 #include "sysfile.h" |
186 | |
187 int | |
188 dll_init (const Extbyte *arg) | |
189 { | |
190 return 0; | |
191 } | |
192 | 174 |
193 dll_handle | 175 dll_handle |
194 dll_open (Lisp_Object fname) | 176 dll_open (Lisp_Object fname) |
195 { | 177 { |
196 Extbyte *soname; | 178 Extbyte *soname; |
235 /* This section supports MacOSX dynamic libraries. Dynamically | 217 /* This section supports MacOSX dynamic libraries. Dynamically |
236 loadable libraries must be compiled as bundles, not dynamiclibs. | 218 loadable libraries must be compiled as bundles, not dynamiclibs. |
237 */ | 219 */ |
238 | 220 |
239 #include <mach-o/dyld.h> | 221 #include <mach-o/dyld.h> |
240 | |
241 int | |
242 dll_init (const Extbyte *arg) | |
243 { | |
244 return 0; | |
245 } | |
246 | 222 |
247 dll_handle | 223 dll_handle |
248 dll_open (Lisp_Object fname) | 224 dll_open (Lisp_Object fname) |
249 { | 225 { |
250 Extbyte *soname; | 226 Extbyte *soname; |
449 int errorNumber; | 425 int errorNumber; |
450 const CIbyte *fileNameWithError, *errorString; | 426 const CIbyte *fileNameWithError, *errorString; |
451 NSLinkEditError(&c, &errorNumber, &fileNameWithError, &errorString); | 427 NSLinkEditError(&c, &errorNumber, &fileNameWithError, &errorString); |
452 return build_ext_string (errorString, Qnative); | 428 return build_ext_string (errorString, Qnative); |
453 } | 429 } |
430 #elif HAVE_LTDL | |
431 /* Libtool's libltdl */ | |
432 #include <ltdl.h> | |
433 | |
434 dll_handle | |
435 dll_open (Lisp_Object fname) | |
436 { | |
437 Extbyte *soname; | |
438 | |
439 if (NILP (fname)) | |
440 { | |
441 soname = NULL; | |
442 } | |
443 else | |
444 { | |
445 LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); | |
446 } | |
447 return (dll_handle) lt_dlopen (soname); | |
448 } | |
449 | |
450 int | |
451 dll_close (dll_handle h) | |
452 { | |
453 return lt_dlclose ((lt_dlhandle) h); | |
454 } | |
455 | |
456 dll_func | |
457 dll_function (dll_handle h, const CIbyte *n) | |
458 { | |
459 MAYBE_PREPEND_UNDERSCORE (n); | |
460 return (dll_func) lt_dlsym ((lt_dlhandle) h, n); | |
461 } | |
462 | |
463 dll_var | |
464 dll_variable (dll_handle h, const CIbyte *n) | |
465 { | |
466 MAYBE_PREPEND_UNDERSCORE (n); | |
467 return (dll_var) lt_dlsym ((lt_dlhandle) h, n); | |
468 } | |
469 | |
470 Lisp_Object | |
471 dll_error () | |
472 { | |
473 return build_ext_string (lt_dlerror (), Qnative); | |
474 } | |
454 #else | 475 #else |
455 /* Catchall if we don't know about this system's method of dynamic loading */ | 476 /* Catchall if we don't know about this system's method of dynamic loading */ |
456 int | |
457 dll_init (const Extbyte *arg) | |
458 { | |
459 return -1; | |
460 } | |
461 | |
462 dll_handle | 477 dll_handle |
463 dll_open (Lisp_Object fname) | 478 dll_open (Lisp_Object fname) |
464 { | 479 { |
465 return NULL; | 480 return NULL; |
466 } | 481 } |