about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-08 05:20:44 +0000
committerEric Wong <e@80x24.org>2023-01-08 21:41:36 +0000
commitbabee7d4dfbf0771621f51dc1e438fad019efe1e (patch)
treeb241f783f28272ca60f88ccbc25aa1dac27efbed
parent8ae75563b2ef53be721338faada7b29717b56541 (diff)
downloadmwrap-babee7d4dfbf0771621f51dc1e438fad019efe1e.tar.gz
A weak symbol works fine, here.
-rw-r--r--ext/mwrap/mwrap.c3
-rw-r--r--ext/mwrap/mwrap_core.h1
2 files changed, 2 insertions, 2 deletions
diff --git a/ext/mwrap/mwrap.c b/ext/mwrap/mwrap.c
index d88fee6..a45bb38 100644
--- a/ext/mwrap/mwrap.c
+++ b/ext/mwrap/mwrap.c
@@ -6,6 +6,7 @@
 #include "mwrap_core.h"
 
 static ID id_uminus;
+extern VALUE __attribute__((weak)) rb_stderr;
 extern VALUE __attribute__((weak)) rb_cObject;
 extern VALUE __attribute__((weak)) rb_eTypeError;
 extern VALUE __attribute__((weak)) rb_yield(VALUE);
@@ -33,7 +34,7 @@ static VALUE mwrap_dump(int argc, VALUE *argv, VALUE mod)
 
         if (NIL_P(io))
                 /* library may be linked w/o Ruby */
-                io = *((VALUE *)dlsym(RTLD_DEFAULT, "rb_stderr"));
+                io = rb_stderr;
 
         a.min = NIL_P(min) ? 0 : NUM2SIZET(min);
         io = rb_io_get_io(io);
diff --git a/ext/mwrap/mwrap_core.h b/ext/mwrap/mwrap_core.h
index c0eea2f..721e5d3 100644
--- a/ext/mwrap/mwrap_core.h
+++ b/ext/mwrap/mwrap_core.h
@@ -26,7 +26,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <dlfcn.h>
 #include <assert.h>
 #include <errno.h>
 #include <sys/types.h>