在 2026-10-5 20:39, Pali Rohár 写道:
On WinNT systems with older CRT DLL library, the printf() crashes when is called from main EXE's native PE TLS callback for DLL_PROCESS_DETACH event. Seems that this is because CRT DLL library already deinitialized memory or stdio handles.Instead of CRT printf() function in PE TLS callback, use native WinAPI WriteFile() function, which can be called at anytime of the process lifetime. Retrieve a copy/duplicate of stdout WinAPI HANDLE needed for WriteFile() via DuplicateHandle() + _get_osfhandle() functions. --- .../testcases/t_tls_exe_native_process_detach.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
Thanks. Pushed now. -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
