Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/bench_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module BenchTime
module Posix
extend FFI::Library
ffi_lib FFI::Library::LIBC
if RUBY_PLATFORM =~ /mswin/
if FFI::Library::LIBC =~ /ucrtbase/
attach_function :time, :_time64, [ :buffer_out ], :uint64, ignore_error: true
else
attach_function :time, [ :buffer_out ], :ulong, ignore_error: true
Expand Down
7 changes: 2 additions & 5 deletions lib/ffi/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,8 @@ def self.is_os(os)
end

LIBC = if IS_WINDOWS
if RbConfig::CONFIG['host_os'] =~ /mingw/i
RbConfig::CONFIG['RUBY_SO_NAME'].split('-')[-2] + '.dll'
else
"ucrtbase.dll"
end
crtname = RbConfig::CONFIG["RUBY_SO_NAME"][/msvc\w+/] || 'ucrtbase'
"#{crtname}.dll"
elsif IS_GNU
GNU_LIBC
elsif OS == 'cygwin'
Expand Down