Takashi Yano via Cygwin wrote:
On Thu, 21 Sep 2023 21:06:59 +0200
Christian Franke wrote:
...
According to libstdc++ source, the internal function
locale::facet::_S_create_c_locale() calls some __newlocale() which
apparently does not arrive at newlocale() from cygwin1.dll. But
cygstdc++-6.dll imports newlocale() from cygwin1.dll.
Thanks for the pointer. I looked into the cygstdc++6.dll source code,
and noticed that the code you mentioned is for glibc. In glibc,
__newlocale() is defined and newlocale() is a weak alias for that.

For generic libc (i.e. other than glibc), _S_create_c_locale() is
defined as:

   void
   locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
                     __c_locale)
   {
     // Currently, the generic model only supports the "C" locale.
     // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
     __cloc = 0;
     if (strcmp(__s, "C"))
       __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
                 "name not valid"));
   }

in /libstdc++-v3/config/locale/generic/c_locale.cc.

Thanks for clarification. Same applies to MinGW-w64 runtime.

The reason why cygstdc++-6.dll imports newlocale() and other *locale() from cygwin1.dll are only the C++17 std::from_chars() functions (src/c++17/floating_from_chars.cc). These switch temporarily to "C" locale. MinGW-w64 does not support these.

--
Regards,
Christian


--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to