diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-11 02:12:09 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-11 02:12:09 +0000 |
commit | 14c7be2e5a5738b7f5fa55bc9cefd43a2e8a02d2 (patch) | |
tree | 2ae84e32d28cded8d08a4856635809b51953294e /dln.c | |
parent | 4a680e81f2a7521518890bc6f0dd94411efff7f7 (diff) |
merge revision(s) 50416: [Backport #11111]
dln.c: fix EXTERNAL_PREFIX
* configure.in (EXPORT_PREFIX): revert r50410.
* dln.c (EXTERNAL_PREFIX): define by predefined macros.
configured EXPORT_PREFIX is different thing.
* win32/Makefile.sub: r50414-50415.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@50469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dln.c')
-rw-r--r-- | dln.c | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -107,10 +107,11 @@ dln_loaderror(const char *format, ...) #ifndef FUNCNAME_PATTERN # if defined(__hp9000s300) || ((defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(__ELF__)) || defined(__BORLANDC__) || defined(NeXT) || defined(__WATCOMC__) || defined(MACOSX_DYLD) -# define FUNCNAME_PREFIX "_Init_" +# define EXTERNAL_PREFIX "_" # else -# define FUNCNAME_PREFIX "Init_" +# define EXTERNAL_PREFIX "" # endif +# define FUNCNAME_PREFIX EXTERNAL_PREFIX"Init_" #endif #if defined __CYGWIN__ || defined DOSISH @@ -1340,6 +1341,24 @@ dln_load(const char *file) goto failed; } +# if defined RUBY_EXPORT + { + static const char incompatible[] = "incompatible library version"; + void *ex = dlsym(handle, EXTERNAL_PREFIX"ruby_xmalloc"); + if (ex && ex != ruby_xmalloc) { + +# if defined __APPLE__ + /* dlclose() segfaults */ + rb_fatal("%s - %s", incompatible, file); +# else + dlclose(handle); + error = incompatible; + goto failed; +# endif + } + } +# endif + init_fct = (void(*)())(VALUE)dlsym(handle, buf); #ifdef __native_client__ strcpy(file, orig); |