summaryrefslogtreecommitdiff
path: root/dln.c
diff options
context:
space:
mode:
Diffstat (limited to 'dln.c')
-rw-r--r--dln.c15
1 files changed, 15 insertions, 0 deletions
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) {