On Friday 17 January 2025 15:22:30 Lasse Collin wrote:
> 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.

If some DLL library will use sizeof(DIR) then it is part of ABI. But is
questionable if such thing should be allowed or not.

> Another possible change could be to call FindFirstFileW directly instead
> of going via _wfindfirst.

Personally I would prefer to stay with _wfindfirst as it is from
MS C runtime library.

> > > 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

No problem.


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

Reply via email to