lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 29/07/2011 14.56, KHMan wrote:
On 7/29/2011 7:47 PM, Lorenzo Donati wrote:
On 27/07/2011 23.10, Luiz Henrique de Figueiredo wrote:
[snipped all]
So there must be some strange combination of compiler flags in the
standard makefile that makes GCC do the wrong thing for %lld in
printf.

I also checked with DependencyWalker that test.exe uses the same
runtime (only msvcrt.dll). So it seems that it isn't msvcrt's
fault either.
[snip]

Adding -D__USE_MINGW_ANSI_STDIO into SYSCFLAGS in the Makefile will give
the proper 'll' result, after fixing the LUA_WIN defines in luaconf.h to
include LUA_USE_LONGLONG. This pulls in a more complete *printf from
mingwex.

That worked! Thank you very much KHman!

I already tried the LUA_USE_LONG_LONG path, but alone it wasn't enough.

Just for reference I attach a patch with the mods that worked for me.

BTW I wonder if this issue is going to be fixed in some way in 5.2.0. Lua team hasn't commented on the subject so I wonder whether it is considered a bug to be squashed in the official distro, or it is to be viewed simply as a "platform idiosyncrasy" to be coped with downstream.



Or _mingw.h says this works too:

#define __MINGW_FEATURES__ __USE_MINGW_ANSI_STDIO

I dunno whether this or "I64" is the better solution.

-- Lorenzo
diff --git a/Makefile b/Makefile
index da62ab9..f2e3c63 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
 # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
 
 # Your platform. See PLATS for possible values.
-PLAT= none
+PLAT= mingw
 
 # Where to install. The installation starts in the src and doc directories,
 # so take care if INSTALL_TOP is not an absolute path. See the local target.
diff --git a/src/Makefile b/src/Makefile
index a77f35d..5924a8e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -19,7 +19,7 @@ SYSCFLAGS=
 SYSLDFLAGS=
 SYSLIBS=
 
-MYCFLAGS=
+MYCFLAGS=-D__USE_MINGW_ANSI_STDIO
 MYLDFLAGS=
 MYLIBS=
 MYOBJS=
diff --git a/src/luaconf.h b/src/luaconf.h
index 1135e50..348710e 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -36,6 +36,7 @@
 #if defined(LUA_WIN)
 #define LUA_DL_DLL
 #define LUA_USE_AFORMAT		/* assume 'printf' handles 'aA' specifiers */
+#define LUA_USE_LONGLONG	/* assume support for long long */
 #endif