Skip to content

Conversation

@JackCarterSmith
Copy link

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 check on 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 stat64 symbol, which aren't pushed in the tagged v13 of MinGW.
Now, with this patch, the symbol is _imp__stat64 instead and use the Windows UCRT .dll directly.

stat() redirect to direct CRT function _stat() and _stati64() on Windows/MinGW env
@rockdaboot
Copy link
Owner

LGTM

Would like to get a second opinion from @eli-schwartz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants