diff --git a/ext/fiddle/lib/fiddle/import.rb b/ext/fiddle/lib/fiddle/import.rb index ae44914ec3..178ebb8c76 100644 --- a/ext/fiddle/lib/fiddle/import.rb +++ b/ext/fiddle/lib/fiddle/import.rb @@ -157,7 +157,8 @@ module Fiddle # :stopdoc: CALL_TYPE_TO_ABI = Hash.new { |h, k| raise RuntimeError, "unsupported call type: #{k}" - }.merge({ :stdcall => (Function::STDCALL rescue Function::DEFAULT), + }.merge({ :stdcall => Function.const_defined?(:STDCALL) ? Function::STDCALL : + Function::DEFAULT, :cdecl => Function::DEFAULT, nil => Function::DEFAULT }).freeze diff --git a/test/fiddle/test_import.rb b/test/fiddle/test_import.rb index e08853da14..387f58295e 100644 --- a/test/fiddle/test_import.rb +++ b/test/fiddle/test_import.rb @@ -147,5 +147,9 @@ module Fiddle r = LIBC.atof("12.34") assert_includes(12.00..13.00, r) end + + def test_no_message_with_debug + assert_in_out_err(%w[--debug -rfiddle/import], 'p Fiddle::Importer', ['Fiddle::Importer']) + end end end if defined?(Fiddle)