Skip to content

Commit 2f401b9

Browse files
committed
Support Ruby 3.1 UCRT binary
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 <ashie@clear-code.com>
1 parent a59b329 commit 2f401b9

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
ruby: [ '2.5', '2.6', '2.7', '3.0' ]
12+
ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1' ]
1313
os:
1414
- windows-latest
1515
experimental: [false]

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ test_script:
1414

1515
environment:
1616
matrix:
17+
- ruby_version: "31-x64"
18+
- ruby_version: "31"
1719
- ruby_version: "30-x64"
1820
- ruby_version: "30"
1921
- ruby_version: "27-x64"

lib/windows/api.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ module Windows
88

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

test/test_windows_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class TC_Windows_API < Test::Unit::TestCase
5353

5454
def setup
5555
@buf = 0.chr * 256
56-
@runtimes = ['msvcrt', 'msvcr80', 'msvcr90', 'msvcr100']
56+
@runtimes = ['msvcrt', 'msvcr80', 'msvcr90', 'msvcr100', 'ucrtbase']
5757
end
5858

5959
def test_version

0 commit comments

Comments
 (0)