ruby / fiddle

A libffi wrapper for Ruby.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Windows] RubyInstaller::Runtime#add_dll_directory raises a Segmental fault.

kojix2 opened this issue · comments

Hi fiddle developers!

Perhaps this issue is related to #48.

  • Windows
  • RubyInstaller
  • Ruby 2.7.2

tes.rb

require 'fiddle'
RubyInstaller::Runtime.add_dll_directory('C:\Users')
ruby tes.rb

Segmental fault occurs.

C:/Ruby27-x64/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/dll_directory.rb:75: [BUG] Segmentation fault
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32]

Interestingly, this error does not occur if you run the script using bundler.

Gemfile:

# frozen_string_literal: true

source "https://rubygems.org"

gem 'fiddle'
bundle install --path=vendor/bundle
bundle exec ruby tes.rb

Some warnings are raised, but Segmental faults are not raised. It seems to have been executed correctly.

C:/Users/kojix2/tmp/vendor/bundle/ruby/2.7.0/gems/fiddle-1.0.3/lib/fiddle.rb:55: warning: already initialized constant Fiddle::RTLD_GLOBAL
C:/Ruby27-x64/lib/ruby/2.7.0/fiddle.rb:53: warning: previous definition of RTLD_GLOBAL was here
C:/Users/kojix2/tmp/vendor/bundle/ruby/2.7.0/gems/fiddle-1.0.3/lib/fiddle.rb:56: warning: already initialized constant Fiddle::RTLD_LAZY
C:/Ruby27-x64/lib/ruby/2.7.0/fiddle.rb:54: warning: previous definition of RTLD_LAZY was here
C:/Users/kojix2/tmp/vendor/bundle/ruby/2.7.0/gems/fiddle-1.0.3/lib/fiddle.rb:57: warning: already initialized constant Fiddle::RTLD_NOW
C:/Ruby27-x64/lib/ruby/2.7.0/fiddle.rb:55: warning: previous definition of RTLD_NOW was here

Thank you.