about summary refs log tree commit homepage
path: root/ext/mwrap/mwrap.c
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 /ext/mwrap/mwrap.c
parent8ae75563b2ef53be721338faada7b29717b56541 (diff)
downloadmwrap-babee7d4dfbf0771621f51dc1e438fad019efe1e.tar.gz
A weak symbol works fine, here.
Diffstat (limited to 'ext/mwrap/mwrap.c')
-rw-r--r--ext/mwrap/mwrap.c3
1 files changed, 2 insertions, 1 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);