Skip to content

Commit

Permalink
Support Ruby 3.1 UCRT binary
Browse files Browse the repository at this point in the history
RubyInstaller has migrate from msvcrt.dll to ucrt.dll:
https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html

So that symbols should be loaded from later one.
Althouth I considered introducing a new constant like `UCRT_DLL`, this
commit still using `MSVCRT_DLL` even if Ruby is run on ucrt.dll to keep
backward compatibility. I think replacing `MSVCRT_DLL` with `UCRT_DLL`
is almost meaningless, they won't used at same time.

Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie committed Jun 8, 2022
1 parent a59b329 commit 88d139d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ '2.5', '2.6', '2.7', '3.0' ]
ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1' ]
os:
- windows-latest
experimental: [false]
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ test_script:

environment:
matrix:
- ruby_version: "31-x64"
- ruby_version: "31"
- ruby_version: "30-x64"
- ruby_version: "30"
- ruby_version: "27-x64"
Expand Down
4 changes: 3 additions & 1 deletion lib/windows/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ module Windows

# With Microsoft Visual C++ 8 and later users should use the associated
# DLL instead of msvcrt directly, if possible.
if CONFIG['host_os'].split('_')[1]
if RUBY_PLATFORM.split('-')[-1] == "ucrt"
MSVCRT_DLL = 'ucrtbase'
elsif CONFIG['host_os'].split('_')[1]
if CONFIG['host_os'].split('_')[1].to_i >= 80
MSVCRT_DLL = 'msvcr' + CONFIG['host_os'].split('_')[1]
else
Expand Down

0 comments on commit 88d139d

Please sign in to comment.