Jacek Caban <[email protected]> wrote:

> On 6/23/26 14:53, Kirill Makurin wrote:
>> Just note that _create_locale, _free_locale and _get_current_locale are 
>> available in msvcrt.dll since Windows 8, so you could define _WIN32_WINNT to 
>> 0x0602 or higher to expose them with original version of changes I wanted to 
>> send.
>
>
> Yes, it's arguably a bug in llvm-mingw, which explicitly sets
> _WIN32_WINNT to a version not supported by libc++ (or at least, not
> supported in the msvcrt.dll build; it's fine on UCRT). However, I'm sure
> that this is not an isolated case. Other users relying on those
> functions will break in the exact same way. The easiest solution to
> avoid breaking existing setups is simply not add these version guards.

My honest opinion is that using _locale_t with msvcrt.dll is a can of worms:

1. Many locale-specific functions were added in Vista OS version of msvcrt.dll 
(as you can see in msvcrt.def.in); however, functions _create_locale and 
_free_locale were missing until Windows 8, making those locale-specific 
functions completely unusable. Any project which uses them will misbehave on 
pre-Windows 8 systems.

2. Some functions, notably _strftime_l, were never added to msvcrt.dll; static 
libc++ somehow contains reference to this function, which makes it completely 
unusable with msvcrt.dll. I mentioned it in my original "Updates for crt 
testcases" message and as the result I had to disable a few C++ tests on 
arm64ec because we link libc++ statically there.

My opinion that in a long run, we should remove those wrappers for 
_create_locale, _free_locale and _get_current_locale, and make it clear that if 
you build for msvcrt.dll you either:

1. Define _WIN32_WINNT appropriately to 0x0602 or higher so you can use 
_locale_t; or
2. You do not use _locale_t at all.

With the current state of things, we allow production of semi-functional 
applications/libraries which will completely misbehave when run on pre-Windows 
8 systems.

- Kirill Makurin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to