On Sat, 21 May 2022, LIU Hao wrote:
在 2022-05-20 21:17, Martin Storsjö 写道:
__mingw_access() was introduced as the msvcrt.dll access() function
reportedly returned errors when passed the X_OK constant on
Vista.
Users who expect to be calling access() with the X_OK constant could
set the __USE_MINGW_ACCESS define to get a mingw specific reimplementation
of the function. GCC has been setting this define to work around this
issue (but there have been cases where the define hasn't applied on all
the source where it's needed).
Current versions of msvcrt.dll no longer seem to have this issue
with X_OK, so the issue has somewhat been forgotten since. But UCRT's
access() function shows the same behaviour of returning errors when
given that constant.
Always defining __USE_MINGW_ACCESS when building targeting UCRT
doesn't work, as the define of access() breaks other valid cases
(e.g. calls to methods named access() in C++ classes).
Instead remove the access() symbol from the import libraries, and
expose an UCRT specific access() that just redirects to __mingw_access().
Signed-off-by: Martin Storsjö <[email protected]>
---
mingw-w64-crt/Makefile.am | 1 +
.../def-include/msvcrt-common.def.in | 4 ++++
.../api-ms-win-crt-filesystem-l1-1-0.def | 3 ++-
mingw-w64-crt/misc/ucrt-access.c | 19 +++++++++++++++++++
4 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 mingw-w64-crt/misc/ucrt-access.c
This patch looks good to me. Thanks.
Thanks, I pushed this now then.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public