Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On windows, when using Ruby built with mingw64, FFI:LIBC returns msvc…
…rt.dll. When using Ruby built with MSVC, FFI:LIBC returns vcruntime.dll Neither is correct. Starting in Visual Studio 2015, the C runtime library migrated to ucrtbase.dll. See https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=vs-2019 for more information. Or https://devblogs.microsoft.com/cppblog/introducing-the-universal-crt/. I assume this hasn't been reported as a bug since almost no one uses a MSVC Ruby build, and attach_function for functions like malloc does actually work using msvcrt.dll - but does not with vcruntime.dll This patch changes mingw64 and mswin to use ucrtbase.dll for the C library. Tested both with mswin and mingw64 Ruby builds. The one downside of this patch is that it would break for anyone running a version of Windows that hasn't been updated since Spring 2015 when Microsoft introduced this change (the dll ships with Windows 10 and was back ported to older windows versions via Windows update). So seems to me a very, very low risk.
- Loading branch information