ctype.h has macro versions of _is*_l functions which access _locale_t's fields. 
I wonder if they may be affected by different layout of threadlocaleinfostruct 
structure.

- Kirill Makurin
________________________________
From: Pali Rohár <[email protected]>
Sent: Wednesday, September 24, 2025 6:44 PM
To: Martin Storsjö <[email protected]>
Cc: [email protected] 
<[email protected]>
Subject: Re: [Mingw-w64-public] [PATCH] headers: Fix struct 
threadlocaleinfostruct for different msvcrt versions

On Wednesday 24 September 2025 12:15:51 Martin Storsjö wrote:
> On Wed, 24 Sep 2025, LIU Hao wrote:
>
> > 在 2025-9-24 16:50, Pali Rohár 写道:
> > > On Wednesday 24 September 2025 10:34:19 LIU Hao wrote:
> > > > 在 2025-9-1 00:39, Pali Rohár 写道:
> > > > > struct threadlocaleinfostruct was introduced in msvcr70.dll and in 
> > > > > each
> > > > > msvcrt version it was slightly updated. Fix this structure in 
> > > > > corecrt.h
> > > > > header file to match the binary ABI of the msvcrt version which is 
> > > > > used
> > > > > to compile current object file according to __MSVCRT_VERSION__ and 
> > > > > _UCRT
> > > > > macros.
> > > > >
> > > > > UCRT renamed few members and for source file compatibility use 
> > > > > anonymous
> > > > > union for accessing both the old msvcrt name and new UCRT name.
> > > > > ---
> > > > >    mingw-w64-headers/crt/corecrt.h | 35 
> > > > > +++++++++++++++++++++++++++++----
> > > > >    1 file changed, 31 insertions(+), 4 deletions(-)
> > > > >
> > > >
> > > > Do you have a UCRT definition that is publicly available somewhere?
> > >
> > > I found it in UCRT file src/ucrt/inc/corecrt_internal.h named as:
> > > typedef struct __crt_locale_data
> >
> > Yes but that's not a public header. The current declaration matches
> > `__crt_locale_data_public` in corecrt.h.
> >
> > We probably don't want to expose too many details beneath that.
>
> I agree.
>
> Also, keep in mind that the UCRT source isn't licensed under an actual open
> source license that allows derivative works of it, or allows free
> redistribution of it. If we want to keep mingw-w64 licensed like it is, we
> can't have the UCRT source influence our code in a way that it could be
> argued to be derived from the UCRT source.
>
> // Martin

I understand. I just looked at the order of existing members adjusted
the existing mingw-w64 code.

The point here is that every crt version has different struct
threadlocaleinfostruct and having incorrect structure definition is a
bad thing.

I'm thinking if it is not rather better to drop this structure from
mingw-w64 header files completely? We have definition which matches some
msvcrt version but we do not know how it was being changed in system OS
msvcrt library...


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

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

Reply via email to