summaryrefslogtreecommitdiff
path: root/ext/fiddle
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2020-08-15 13:19:23 +0900
committerSutou Kouhei <kou@cozmixng.org>2020-11-18 09:05:13 +0900
commitaff5eaced4ca458bebc59b62502c2addc3d7364a (patch)
treece3a8f48847d04fa23bdfe1703fd87e8871c0cc4 /ext/fiddle
parent307388ea19f5c9d1c8c417d1979c40d970b420a2 (diff)
[ruby/fiddle] Add workaround for RubyInstaller for Windows
See comment for details. https://github.com/ruby/fiddle/commit/0c76f03dc4
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3780
Diffstat (limited to 'ext/fiddle')
-rw-r--r--ext/fiddle/fiddle.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c
index 5f2bd5ae20..5635ab327c 100644
--- a/ext/fiddle/fiddle.c
+++ b/ext/fiddle/fiddle.c
@@ -142,6 +142,20 @@ Init_fiddle(void)
rb_eFiddleError = rb_define_class_under(mFiddle, "Error", rb_eStandardError);
/*
+ * Ruby installed by RubyInstaller for Windows always require
+ * bundled Fiddle because ruby_installer/runtime/dll_directory.rb
+ * requires Fiddle. It's used by
+ * rubygems/defaults/operating_system.rb. It means that the
+ * bundled Fiddle is always required on initialization.
+ *
+ * We just remove existing Fiddle::DLError here to override
+ * the bundled Fiddle.
+ */
+ if (rb_const_defined(mFiddle, rb_intern("DLError"))) {
+ rb_const_remove(mFiddle, rb_intern("DLError"));
+ }
+
+ /*
* Document-class: Fiddle::DLError
*
* standard dynamic load exception