在 2019/8/25 23:14, LRN 写道:
> The way i read _mingw_stat64.h and sys/stat.h, if _FILE_OFFSET_BITS is
> undefined (i.e. autotools is not being used) and the host architecture is
> x86_64, we end up with struct stat that has 32-bit st_size field, because
> _off_t is always 32-bit, and there's no macro to turn stat into _stat64,
> because that macro only gets defined when _FILE_OFFSET_BITS is 64.
> 
> GNU docs say that _FILE_OFFSET_BITS should have no effect on 64-bit hosts, but
> it is clearly not the case. So either the docs are wrong (i'm too , or
> mingw-w64 LFS support is slightly broken. I've tested this on Debian x86_64,
> and `struct stat` has 64-bit st_size field, even if _FILE_OFFSET_BITS is 
> undefined.
> 
> The easiest way to fix this is probably to change sys/stat.h and ensure that
> stat() is defined as _stat64 even if _FILE_OFFSET_BITS is undefined (but the
> host is 64-bit).
> 
> 

I am afraid this is not something easy to fix, as compiling and running
the following C code with CL (the Microsoft compiler) prints `4` even on
x64. Code that was compiled with MSVC for x64 might expect otherwise.

```
#include <stdio.h>
#include <sys/stat.h>

int main(void)
  {
    struct stat st;
    printf("size = %d\n", (int)sizeof(st.st_size));
  }

```



-- 
Best regards,
LH_Mouse



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

Reply via email to