在 2026-7-7 00:58, Kirill Makurin 写道:
Hello, I would like to remind about this patch series.
The first patch adds a new header, corecrt_wlocale.h; but in Microsoft CRT there's no such header. I don't think the change is right.
The second and third patches undefine some macros. That may be fine, since UCRT headers don't define the any more; however they are defined by WDK (kernel-mode) locale.h.
Both sets of functions were introduced in msvcr80.dll. Vista's msvcrt.dll added many of those _l-suffixed functions (see msvcrt.def.in for complete list), however it did not have functions `_create_locale` and `_free_locale` to create `_locale_t` objects, so they were practically useless. Finally, Windows 8's msvcrt.dll got `_create_locale` and `_free_locale`. Currently, we expose `_create_locale`, `_free_locale` and `_get_current_locale` unconditionally.
IIRC libc++ used to require MSVCR80+ some years ago; with MSVCRT, it did not build at that time. However MSVCR80 and 90 require manifests so are tricky already; it's recommended to link against MSVCR100 at least.
If they do require Windows 8 MSVCRT, it's possible to build libc++.dll with `-Wl,--subsystem,windows:6.2`.(6.3 isn't operational yet, as it requires `SecurityCookie` be set in the Load Config Directory of an image, which mingw-w64 doesn't do at the moment.)
For msvcrt.dll, we provide wrappers which check their presence at runtime, and replace them with simple stubs if they are not available. Original commit[1] which added wrapper for `_get_current_locale` states that it was added to allow building libc++ with msvcrt.dll, or at least this is my understanding. In my previous replies I expressed my opinion that we eventually should fix this and expose them only when _WIN32_WINNT set to 0x0602 or higher. In the meantime, we can continue always exposing them with msvcrt.dll, so project like libc++ continue building as expected. For any other pre-msvcr80.dll, those functions are not available at all and should not be exposed. Unlike msvcrt.dll, we do not provide stubs for them (and why would we?). Similarly, we expose `_configthreadlocale` unconditionally. This function is not available in msvcrt.dll at all. Unlike `_locale_t` functions, this function is called in crtexe.c, and so we provide stubs for all CRTs which do not have it. However, I think this function must only be exposed when compiling for msvcr80.dll or later. Unfortunately, we have projects like libc++ which use it unconditionally, and doing so would break them. For this reason, the sent changes keep exposing it for msvcrt.dll until it gets fixed (if ever).
If that's the case, it should be called via `GetProcAddress()`. -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
