Roberto,
I noticed the commit ( 9a3940380a2a1540dc500593a6de0c1c5e6feb69 ) in the GitHub mirror adding the `LUA_USE_OFF_T` compilation flag allowing MinGW / MinGW-w64 to use POSIX-like API for file offsets. Thank you for the addition.
If my guess is correct, in the upcoming version of Lua 5.5.0, I think that you are going to change `src/Makefile` at line 132 to use
"SYSCFLAGS=-DLUA_BUILD_AS_DLL -DLUA_USE_OFF_T" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
That way, the fseek problem would be solved for MinGW-w64 (
https://sourceforge.net/projects/mingw-w64/ ), but not for the legacy 32-bit MinGW (
https://sourceforge.net/projects/mingw/ ).
Not sure if you are interested, but in case a fix for MinGW is also desired, I have a suggestion.
DISCLAIMER: The proposed changes in the file `src/Makefile` below, I am placing under the same license found at
https://www.lua.org/license.htmlEven though I have read `liolib.c` at least a dozen times, I just noticed the line `#if !defined(l_fseek)` today. Then, I realized that it allows the `fseek` problem to be solved just by changing `src/Makefile` from lua-5.5.0-beta tarball at line 132:
where it is:
"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
can be replaced by:
"SYSCFLAGS=-DLUA_BUILD_AS_DLL -Dl_fseek=fseeko64 -Dl_ftell=ftello64 -Dl_seeknum=off64_t" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
Applying such replacement above, it fixes the fseek problem for both MinGW / MinGW-w64 (I tested the changes locally).
Note 1: If you want, I can rerun the GitHub Action tests applying such replacement in the Makefile.
Note 2: I also noticed that my `lua-fseek-analysis` repository was MIT licensed. In the next commit to test the upcoming changes on Lua 5.5.0 (beta-2 or RC or whatever), I'll relicense it to use
https://www.lua.org/license.html . This move has the intent to not cause any worries in the use of the proposed changes by the Lua team, which may arise due the copyright notice required by the MIT license.