From df875018d7eb5c2babbffb26c3120c9a159dbc64 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 19 Apr 2024 00:16:52 -0500 Subject: [PATCH] Fix dll path issue with Ruby on windows Signed-off-by: Addisu Z. Taddese --- src/cmd/cmdsdformat.rb.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cmd/cmdsdformat.rb.in b/src/cmd/cmdsdformat.rb.in index 45560acc6..ff9f3d16e 100644 --- a/src/cmd/cmdsdformat.rb.in +++ b/src/cmd/cmdsdformat.rb.in @@ -185,6 +185,15 @@ class Cmd end conf_version = LIBRARY_VERSION + if defined? RubyInstaller + # RubyInstaller does not search for dlls in PATH or the directory that tests are running from, + # so we'll add the parent directory of the plugin to the search path. + ENV['RUBY_DLL_PATH'] = ENV['PATH'] + RubyInstaller::Runtime.enable_dll_search_paths + # https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#-dll-loading + RubyInstaller::Runtime.add_dll_directory(File.dirname(plugin)) + end + begin Importer.dlload plugin rescue DLError => error