[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.3.1: file:seek() and files larger than 2 GB
- From: Philipp Janda <siffiejoe@...>
- Date: Sun, 4 Oct 2015 14:01:04 +0200
Am 04.10.2015 um 07:21 schröbte Paul K:
I saw a discussion some time ago on making file seek/tell to work with
large (>2GB) files on Windows 32bit:
I used Roberto's suggestion, but modified it slightly as the linker
couldn't find fseeko and ftello (I replaced them with fseeko64 and
#if defined(liolib_c) && defined(__MINGW32__)
#define l_fseek(f,o,w) fseeko64(f,o,w)
#define l_ftell(f) ftello64(f)
#define l_seeknum off_t
You should use `off64_t` here instead. `off_t` is typedefed as `long`
which is 32 bit on Windows.
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.
Works fine here! Maybe your lua.exe is picking up the wrong DLL?!