diff --git a/ChangeLog b/ChangeLog index fd55d5d22b..2b0cca6029 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri May 1 13:30:24 2015 Nobuyoshi Nakada + + * dln.c (dln_load): check if a different libruby is loaded by the + extension library, and then bail out to get rid of very frequent + reported stale bug reports. + Thu Apr 30 19:51:11 2015 Nobuyoshi Nakada * compile.c (iseq_compile_each): revert r46873 and r46875, not to diff --git a/dln.c b/dln.c index aa1e622641..b0ac56e55e 100644 --- a/dln.c +++ b/dln.c @@ -1324,6 +1324,21 @@ dln_load(const char *file) error = dln_strerror(); goto failed; } +# if defined RUBY_EXPORT + { + static const char incompatible[] = "incompatible library version"; + void *ex = dlsym(handle, EXPORT_PREFIX"ruby_xmalloc"); + if (ex && ex != ruby_xmalloc) { + +# if !defined __APPLE__ + /* dlclose() segfaults */ + dlclose(handle); +# endif + error = incompatible; + goto failed; + } + } +# endif init_fct = (void(*)())(VALUE)dlsym(handle, buf); if (init_fct == NULL) {