[GRASS-dev] diglib test.c fails on 64bit win

Glynn Clements glynn at gclements.plus.com
Tue May 18 13:00:17 EDT 2010


Markus Metz wrote:

> > In 6.x, LFS is enabled for specific libraries or modules using e.g.:
> >
> >        ifneq ($(USE_LARGEFILES),)
> >                EXTRA_CFLAGS = -D_FILE_OFFSET_BITS=64
> >        endif
> >
> > in the corresponding Makefile. This needs to be done on a case-by-case
> > basis because not all modules are LFS-aware, e.g. because they
> > calculate offsets using "int" or "long" arithmetic, or use
> > fseek/ftell.
> 
> IOW, for 6.x and mingw32, each module would need to decide if it wants
> to use e.g. fseeko64 or fseek.

We don't use fseeko() directly. In 6.x, modules which use fseek() are
built without LFS; in 7.0, G_fseek() is used.

> So, how about

>  #ifdef __MINGW32__

#if defined(__MINGW32__) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64

> +/* add/remove as needed */
>  #define off_t off64_t
>  #define fseeko fseeko64
>  #define ftello ftello64
> +#define lseek lseek64
> +#define tell tell64
> +#define seek seek64
> +#define stat stat64
> +#define fstat fstat64

If you redirect stat() to stat64(), you also need to redirect
"struct stat" to "struct __stat64". But I'm not sure how to go about
that.

Also, there are two 64-bit stat interfaces, stati64() and
"struct _stati64", and stat64() and "struct __stat64". AFAICT, the
latter requires MSVCRT >= 6.1 (and uses __time64_t instead of time_t
for the timestamps).


-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list