在 2025-5-14 18:46, Martin Storsjö 写道:
On Fri, 9 May 2025, Pali Rohár wrote:
msvc has more object configuration files which are supposed to be passed
to linker, and they change behavior of the startup code. Documentation:

https://learn.microsoft.com/en-us/cpp/c-runtime-library/link-options

In works in a way that every object file just initialize variable to
some specific value. And all those variables are used by the startup
code which is always linked.

There are some "fallback" object files which are linked when symbols are
not explicitly defined by specifying one of those above object
configuration file, or by the application itself.

If this is the recommended setup for users, I think we should do the same, by providing 'threadlocale.o'. There are already similar objects such as 'binmode.o'.

If user programs do not link with 'threadlocale.obj', the default value seems 
to be zero?


For this __globallocalestatus variable. There is a threadlocale.obj file
which sets the __globallocalestatus to -1 and hence activates the
per-thread locale by default for all new spawned thread.

In mingw-w64 we do not have an object file threadlocale.o and neither
import library which could do similar thing. But applications are free
to define that variable by their own and so enable per-thread locales
globally.

I agree that __globallocalestatus variable is somehow undocumented but
it is available in header files as a public one.

Can I have an opinion from LH and Jacek on this one?

// Martin


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to