I saw a discussion some time ago on making file seek/tell to work with
large (>2GB) files on Windows 32bit:
http://lua-users.org/lists/lua-l/2015-05/msg00370.html
I used Roberto's suggestion, but modified it slightly as the linker
couldn't find fseeko and ftello (I replaced them with fseeko64 and
ftello64):
#if defined(liolib_c) && defined(__MINGW32__)
#include <sys/types.h>
#define l_fseek(f,o,w) fseeko64(f,o,w)
#define l_ftell(f) ftello64(f)
#define l_seeknum off_t
#endif
I compiled Lua 5.3.1 with mingw 4.8.1 and everything has been working
as expected, but I only tested it on one machine. Is it the right way
to apply this fix?
I initially was confused by the message from f:seek("end"), which
returned (on a large file):
nil "Invalid argument" 22
f:seek("set", -1) returned the same result. I think it's a bit
misleading as there is nothing wrong with the arguments I passed.