Mercurial > hg > xemacs-beta
comparison src/sysdll.c @ 388:aabb7f5b1c81 r21-2-9
Import from CVS: tag r21-2-9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:09:42 +0200 |
parents | 8626e4521993 |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
387:f892a9d0bb8d | 388:aabb7f5b1c81 |
---|---|
23 #include <config.h> | 23 #include <config.h> |
24 #endif | 24 #endif |
25 | 25 |
26 #include "sysdll.h" | 26 #include "sysdll.h" |
27 | 27 |
28 /* This whole file is conditional upon HAVE_DLL */ | 28 /* This whole file is conditional upon HAVE_SHLIB */ |
29 #ifdef HAVE_SHLIB | 29 #ifdef HAVE_SHLIB |
30 | 30 |
31 /* Thankfully, most systems follow the ELFish dlopen() method. | 31 /* Thankfully, most systems follow the ELFish dlopen() method. |
32 ** HAVE__DLOPEN is lame, but SCO has their dl* functions as _dl*, and | 32 ** HAVE__DLOPEN is lame, but SCO has their dl* functions as _dl*, and |
33 ** unless you include dlfcn.h you don't get the macros to mask them, and | 33 ** unless you include dlfcn.h you don't get the macros to mask them, and |
34 ** autoconf fails to find them. | 34 ** autoconf fails to find them. No longer true as of 5.0.5. |
35 ** | 35 ** |
36 ** Anybody who wants to use this on SCO needs to have their configure.in | 36 ** Anybody who wants to use this on SCO needs to have their configure.in |
37 ** look for _dlopen() as well as dlopen() | 37 ** look for _dlopen() as well as dlopen() |
38 */ | 38 */ |
39 #if defined(HAVE_DLOPEN) || defined(HAVE__DLOPEN) | 39 #if defined(HAVE_DLOPEN) || defined(HAVE__DLOPEN) || defined(HAVE_DLFCN_H) |
40 #include <dlfcn.h> | 40 #include <dlfcn.h> |
41 | 41 |
42 #ifndef RTLD_LAZY | 42 #ifndef RTLD_LAZY |
43 # define RTLD_LAZY 1 | 43 # define RTLD_LAZY 1 |
44 #endif /* RTLD_LAZY isn't defined under FreeBSD - ick */ | 44 #endif /* RTLD_LAZY isn't defined under FreeBSD - ick */ |
78 } | 78 } |
79 | 79 |
80 dll_var | 80 dll_var |
81 dll_variable (dll_handle h, CONST char *n) | 81 dll_variable (dll_handle h, CONST char *n) |
82 { | 82 { |
83 #ifdef DLSYM_NEEDS_UNDERSCORE | |
84 char *buf = alloca_array (char, strlen (n) + 2); | |
85 *buf = '_'; | |
86 (void)strcpy(buf + 1, n); | |
87 n = buf; | |
88 #endif | |
83 return (dll_var)dlsym ((void *)h, n); | 89 return (dll_var)dlsym ((void *)h, n); |
84 } | 90 } |
85 | 91 |
86 CONST char * | 92 CONST char * |
87 dll_error (dll_handle h) | 93 dll_error (dll_handle h) |
88 { | 94 { |
89 #ifdef HAVE_DLERROR | 95 #if defined(HAVE_DLERROR) || defined(dlerror) |
90 return (CONST char *)dlerror (); | 96 return (CONST char *)dlerror (); |
97 #elif defined(HAVE__DLERROR) | |
98 return (const char *)_dlerror(); | |
91 #else | 99 #else |
92 return "Shared library error"; | 100 return "Shared library error"; |
93 #endif | 101 #endif |
94 } | 102 } |
95 | 103 |