Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows libc detection for MSYS2-ucrt build #903

Merged
merged 3 commits into from Jun 15, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/bench_time.rb
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
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