Skip to content

Commit aff5eac

Browse files
committed
[ruby/fiddle] Add workaround for RubyInstaller for Windows
See comment for details. ruby/fiddle@0c76f03dc4
1 parent 307388e commit aff5eac

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ext/fiddle/fiddle.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,20 @@ Init_fiddle(void)
141141
*/
142142
rb_eFiddleError = rb_define_class_under(mFiddle, "Error", rb_eStandardError);
143143

144+
/*
145+
* Ruby installed by RubyInstaller for Windows always require
146+
* bundled Fiddle because ruby_installer/runtime/dll_directory.rb
147+
* requires Fiddle. It's used by
148+
* rubygems/defaults/operating_system.rb. It means that the
149+
* bundled Fiddle is always required on initialization.
150+
*
151+
* We just remove existing Fiddle::DLError here to override
152+
* the bundled Fiddle.
153+
*/
154+
if (rb_const_defined(mFiddle, rb_intern("DLError"))) {
155+
rb_const_remove(mFiddle, rb_intern("DLError"));
156+
}
157+
144158
/*
145159
* Document-class: Fiddle::DLError
146160
*

0 commit comments

Comments
 (0)