[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (rc1) now available
- From: Patrick Rapin <toupie300@...>
- Date: Fri, 25 Nov 2011 10:56:02 +0100
For our projects, I use a QMake based build platform, which permits me
on Windows to choose between all these tool chains:
- Microsoft Visual Studio (MSVC) 6.0 (very old)
- MSVC 2010, 32 bits
- MSVC 2010, 64 bits
- MinGW, 32 bits
- Cygwin, 32 bits
- Windows DDK, 32 bits
- Windows DDK, 64 bits
By changing three lines from the distribution, Lua 5.2.0 can build
without warnings on all these 7 tool chains.
1) liolib.c, line 81:
< #elif defined(LUA_WIN)
> #elif _MSC_VER >= 1400 && !defined(_CRTIMP_TYPEINFO)
Reason: the _ftelli64 function is a Microsoft feature starting from
MSVC 2005 (14). It is not present in MinGW.
Worse: it is not available in Windows DDK neither, although the
compiler is the same as MSVC 2008, because that build links to the old
system MSVCRT.dll.
After some research, I found the CRTIMP_TYPEINFO symbol, which seems
to be only defined on DDK, so the reason for the second test.
2) loadlib.c, line 15:
< #if defined(LUA_DL_DLL)
> #if defined(_WIN32)
Alternatively, place the #include <windows.h> after #include "lua.h"
In the current situation, it cannot compile at all (except Cygwin)
because windows.h is not included.
3) lobject.h, line 571
< #define twoto(x) (1<<(x))
> #define twoto(x) ((lua_Integer)1<<(x))
I had already signaled that problem before. Without the extra (and in
fact useless) cast, the compilation with 64 bits of MSVC gives a lot
of those warnings:
[ result of 32-bit shift implicitly converted to 64 bits (was 64-bit
shift intended?) ]
My versions of Lua have had this patch for a long time now without any problem.