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 <ashie@clear-code.com>
  • Loading branch information
ashie committed Jun 8, 2022
1 parent a59b329 commit edbb42b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions appveyor.yml
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
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 edbb42b

Please sign in to comment.