Skip to content

Commit

Permalink
Update msvcrt_name
Browse files Browse the repository at this point in the history
This commit updates msvcrt_name to return the value of RUBY_SO_NAME or
ucrtbase.

Change taken from enkessler#182.
  • Loading branch information
chelnak committed Mar 31, 2023
1 parent 8780ab1 commit 0e6ddfc
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/childprocess/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@ module Lib
extend FFI::Library

def self.msvcrt_name
host_part = RbConfig::CONFIG['host_os'].split("_")[1]
manifest = File.join(RbConfig::CONFIG['bindir'], 'ruby.exe.manifest')

if host_part && host_part.to_i > 80 && File.exists?(manifest)
"msvcr#{host_part}"
else
"msvcrt"
end
RbConfig::CONFIG['RUBY_SO_NAME'][/msvc\w+/] || 'ucrtbase'
end

ffi_lib "kernel32", msvcrt_name
ffi_convention :stdcall


end # Library
end # Windows
end # ChildProcess
Expand Down

0 comments on commit 0e6ddfc

Please sign in to comment.