Web lists-archives.com

[Mingw-users] I need a compatible stat64




I'm building a program that uses a subroutine with a lot of file access,
several months back - compiling using mingw-w64 - I switched the use
of stat() to that of stat64() in order to get a 64-bit file size.  This works fine
in mingw-w64, cygwin, and linux but I find now it is invalid in this 
mingw.  Can someone suggest a viable workaround? 


#ifndef _MSC_VER
# include <libgen.h>
# include <sys/types.h>
#endif
#include <sys/fcntl.h>
#include <sys/stat.h>
#ifndef _MSC_VER
# include <unistd.h> 
#endif
...
#ifdef __CYGWIN__
#define stat64 stat
#define lstat64 lstat
// for religious reasons, CYGWIN doesn't do lstat64
#endif
...
#ifdef _WIN32
//
#ifdef _MSC_VER // MSVC uses 64bit internally
#   define stat64 stat
#   define lstat64(x,y) stat(x,y) 
#else
#    define lstat64(x,y) stat64(x,y)
#endif

...
struct stat64 statStruct;
F:/gdl/src/file.cpp:400:22: error: aggregate 'FindInDir(const DString&, const DString&)::stat64 statStruct' has incomplete type and cannot be defined
     struct stat64    statStruct;
                      ^
F:/gdl/src/file.cpp:258:37: error: invalid use of incomplete type 'struct FindInDir(const DString&, const DString&)::stat64'

I tried a simple #define stat64 __stat64 in sys/stat.h but that doesn't fly.

Thanks,
Greg
------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe