bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw and AC_SYS_LARGEFILE


From: Bruno Haible
Subject: Re: mingw and AC_SYS_LARGEFILE
Date: Sun, 15 Apr 2012 13:48:29 +0200
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

> My advice would be first to ask the currently active mingw development
> group, namely the mingw64 project [5], whether they plan to add
> "Large File Support" to their header files.

It turns out, the mingw64 headers provide a *partial* "Large File Support".
Namely, for
  off_t
  <unistd.h> (lseek, ftruncate)
  <stdio.h> (fseeko, ftello)
but not for
  <sys/stat.h> (stat, fstat)

Witness:
===============================================================================
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
int main ()
{
  printf ("off_t is %d-bit\n", 8*sizeof(off_t));
  printf ("stat.st_size is %d-bit\n", 8*sizeof(((struct stat *)0)->st_size));
  return 0;
}
===============================================================================
$ i686-w64-mingw32-gcc foo.c; ./a.exe
off_t is 32-bit
stat.st_size is 32-bit

$ i686-w64-mingw32-gcc -D_FILE_OFFSET_BITS=64 foo.c; ./a.exe
off_t is 64-bit
stat.st_size is 32-bit

AC_SYS_LARGEFILE detects that sizeof(off_t) is sensitive to _FILE_OFFSET_BITS
and therefore adds "#define _FILE_OFFSET_BITS 64" to config.h.


Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]