LIU Hao wrote:

> 在 2026-9-12 07:07, Kirill Makurin 写道:
>> However, I'm not sure if in the current state winphtreads is even loadable 
>> on Win9x systems and static
>> winpthreads would be broken on Win9x due to lack of support for TLS 
>> callbacks in EXEs (thanks to Pali for
>> investigating TLS behavior across Windows versions). I want to add support 
>> for old NT versions as well as
>> Win9x systems. I would prioritize adding support for older NT versions 
>> before Win9x.
>
> Ah I see it now; `__dyn_tls_pthread` is not called from the DLL entry-point 
> routine, but as a TLS callback.

It probably would be better to call it from `DllMain` for the DLL build, and 
call it as a TLS callback for static build.

> So I'm leaving `CreateEventW` alone. There's also one reference to 
> `CreateEventA` in spinlock.c which you
> may fix later.

Yes, I had this one in mind. I'll address this one along with adding fast paths 
for spinlocks later.

>> To give you an example, you can take look at this[1] source file in my 
>> posix32 library, the way it
>> handles `OutputDebugString` functions. The idea is basically to have a 
>> function (e.g.
>> `winpthreads_create_event`) which calls either ANSI or Unicode version of 
>> `CreateEvent`, depending on
>> whether code is running on NT or Win9x. This would also apply to functions 
>> such as `CreateMutex` or
>> `CreateSemaphore`.
>
> `OutputDebugString` is an exception to the common guidance that W functions 
> should be preferred to A
> ones. In reality, `OutputDebugStringW` converts its argument to an ANSI 
> string and calls
> `OutputDebugStringA`, so it's always recommended to call `OutputDebugStringA` 
> directly.

Is this so? Documentation for `WaitForDebugEventEx`[1] gives me impression that 
an application should use it instead of `WaitForDebugEvent` in order to 
retrieve Unicode string passed to `OutputDebugStringW`.

> I have pushed this series patches with these changes:

Thanks!

- Kirill Makurin

[1] 
https://learn.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-waitfordebugeventex

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

Reply via email to