On 2025-01-16 Pali Rohár wrote: > On Thursday 16 January 2025 18:32:08 Lasse Collin wrote: > > I see that sizeof(DIR) depends on _USE_32BIT_TIME_T because DIR > > contains _finddata_t or _wfinddata_t. Luckily no one is supposed to > > access that structure directly. > > That is really bad. So it means if the mingw-w64 runtime is compiled > with _USE_32BIT_TIME_T then opendir() provided by mingw-64 would be > ABI-incompatible with application which will use 64-bit time_t (as it > would change meaning of struct DIR). > > So it means that whole struct DIR could be already broken for > libraries which exports functions like "int foo(DIR *d);" > > I think that we need a new ABI for opendir/readdir without these > problems. And at the same time it can fix these problems related to > encoding.
The structure is about 556 bytes. It could be allocated on stack. Then it wouldn't be in the ABI at all. I added this change to my local tree. Another possible change could be to call FindFirstFileW directly instead of going via _wfindfirst. > > I will send a few dirent patches. > > Feel free to put me into copy. Sorry, I had sent them to the list but without any Cc addresses. I can send them separately if needed but I assume you are subscribed to the list. :-) -- Lasse Collin _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
