Skip to content

Commit

Permalink
Fix dll path issue with Ruby on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey committed Apr 19, 2024
1 parent ef6e67b commit df87501
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cmd/cmdsdformat.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit df87501

Please sign in to comment.