New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSVC 2019 Fixes #779
MSVC 2019 Fixes #779
Conversation
…oft.com/en-us/cpp/c-language/type-long-double?view=vs-2019). Thus libffi built with MSVC does not export it as a separate type. This workaround that issue.
…GCC will do it but I think via an extension, its not part of the C language). Anyway, this fixes the compile error on MSVC.
…ibffi-8.lib. This commit adds that name to the have_library search list. It also adds in have_library calls for libffi_convenience.lib and shlwapi.lib, both of which are required for MSVC to build the bindings.
…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.
… alignment code using ~0x7UL truncates pointers resulting in crashes. Instead, use unsigned long long wich is 8 bytes.
@cfis Thank you for your contributions! There are 3 things I worry about:
|
Thanks for merging. I agree with your points.
|
ffi-1.13.0 switched FFI::Library::LIBC from msvcrt.dll to ucrtbase.dll as part of ffi#779 in commit c674683 . As described in ffi#788 ucrtbase.dll has behavioural changes which shouldn't be released as part of a minor version change of ffi. While the change makes sense for mswin, we revert it for mingw. Fixes ffi#788
These 5 commits fix various issues that prevent Microsoft Visual Studio 2019 from compiling the ffi bindings. Each commit provides details about the specific issue it is fixing.