Updated stat sys function call support on Windows #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following #256.
Why?
I propose a quick patch to directly use crt function _stat() on Windows platform instead of the interface provided by MinGW to avoid breaking compatibility with change in MinGW versions.
As stat() function signature didn't change, it's only a rework of the abstract interface of MinGW who cause a compatibility issue (and not a change in the CRT).
Regression testing
I've tested the changes in this PR using
make checkon a Ubuntu 22.04 platform with GCC-14 for native linux and with GCC-14 MinGW-w64 13 in cross-compilation.Plus I tested on a test program directly on Windows using GCC-14 MinGW-w64 12 natively.
What does this patch involve?
This patch only change the stat() and struct stat redirection from MinGW to direct CRT (similar to how libcurl does it) only on Windows build. The linux sys/stat() is keep untouched.
The stat() symbol in the otutput .a lib on linux is still
stat.On Windows, the previous glitch generated a
stat64symbol, which aren't pushed in the tagged v13 of MinGW.Now, with this patch, the symbol is
_imp__stat64instead and use the Windows UCRT .dll directly.