Hello, I would like to remind about this patch series.

The rest of the message is some context about `_locale_t` functions and 
`_configthreadlocale`. I hope it will explain my motivation for adding those 
guards.

We have two different sets of Microsoft-specific functions in locale.h:

1. Functions to create locale objects `_locale_t`; these loosely resemble POSIX 
`locale_t`. Microsoft provides _l-suffixed versions of many locale-dependent 
functions; those _l-suffixed versions take those `_locale_t` objects.

2. Function `_configthreadlocale` which allows to set locale for a thread 
compared to setting locale for the whole process.

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.

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).

- Kirill Makurin

[1] 
https://github.com/mingw-w64/mingw-w64/commit/87558c151f0a447d8f00af1a7d3a88a273aa8c23

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

Reply via email to