lua-users home
lua-l archive

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


Nailed the problem, I forgot that lua_pushstring returns the string in
Lua 5.2. The compiler was trying to unify the results of
lua_pushstring and lua_pushnil by casting the result of lua_pushnil to
(const char *) instead of throwing away the result of lua_pushstring,
which obviously does not work. :-) The error message threw me off the
scent by making me believe that the explicit cast was the problem (I
though the void instead of void* in the error message was just a
quirk).

Changed from ?: to an if-else, so it should work now. :-)

--
Fabio Mascarenhas


On Tue, Mar 1, 2011 at 5:13 PM, Attila <ejjeliorjarat@gmail.com> wrote:
> 841. line: alien_function_call function, case AT_STRING
> (sret ? lua_pushstring(L, sret) : lua_pushnil(L)); break;
> 1065. line: alien_buffer_get function, caseAT_STRING
> s ? lua_pushstring(L, s) : lua_pushnil(L);
> These are the lines where the compiler writes the errors.
>
> 2011/3/1 Fabio Mascarenhas <mascarenhas@acm.org>
>>
>> Can you send me the offending lines? The error messages now make no
>> sense to me at all...
>>
>> --
>> Fabio
>>
>>
>> On Tue, Mar 1, 2011 at 4:36 PM, Attila <ejjeliorjarat@gmail.com> wrote:
>> > The output is the same:
>> > E:\Lua\alien>nmake /f makefile.win64
>> > Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
>> > Copyright (C) Microsoft Corporation.  All rights reserved.
>> >         cl /c /MD /Fosrc\alien\core.obj /O2 /DWINDOWS /D_WIN64
>> > /Ic:\usr\local\in
>> > clude /Ilibffi\win32 src\alien\core.c
>> > Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
>> > Copyright (C) Microsoft Corporation.  All rights reserved.
>> > core.c
>> > src\alien\core.c(841) : error C2440: ':' : cannot convert from 'void' to
>> > 'const
>> > char *'
>> > src\alien\core.c(1065) : error C2440: ':' : cannot convert from 'void'
>> > to
>> > 'const
>> >  char *'
>> > NMAKE : fatal error U1077: '"E:\Munka\Programok\Microsoft Visual Studio
>> > 10.0\VC\
>> > BIN\amd64\cl.EXE"' : return code '0x2'
>> > Stop.
>> > E:\Lua\alien>
>> > If you need any help or test just tell me - it would be important for me
>> > to
>> > use alien on x64 machine.
>> > 2011/3/1 Fabio Mascarenhas <mascarenhas@acm.org>
>> >>
>> >> I have no idea why the compiler is complaining about these casts, but
>> >> I commited a patch that removes them in favor of casts in the opposite
>> >> direction. Please tell me if it works, as I only have access to the
>> >> VS2005 x86 compiler and it was not complaining in the first place. :-)
>> >>
>> >> --
>> >> Fabio Mascarenhas
>> >>
>> >>
>> >> On Tue, Mar 1, 2011 at 3:44 PM, Attila <ejjeliorjarat@gmail.com> wrote:
>> >> > I don't know what is that error, but I am unable to compile. Other
>> >> > errors
>> >> > disappeared, but those two still exist:
>> >> > E:\Lua\alien>nmake /f makefile.win64
>> >> > Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
>> >> > Copyright (C) Microsoft Corporation.  All rights reserved.
>> >> >         cl /c /MD /Fosrc\alien\core.obj /O2 /DWINDOWS /D_WIN64
>> >> > /Ic:\usr\local\in
>> >> > clude /Ilibffi\win32 src\alien\core.c
>> >> > Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for
>> >> > x64
>> >> > Copyright (C) Microsoft Corporation.  All rights reserved.
>> >> > core.c
>> >> > src\alien\core.c(840) : error C2440: ':' : cannot convert from 'void'
>> >> > to
>> >> > 'const
>> >> > char *'
>> >> > src\alien\core.c(1064) : error C2440: ':' : cannot convert from
>> >> > 'void'
>> >> > to
>> >> > 'const
>> >> >  char *'
>> >> > NMAKE : fatal error U1077: '"E:\Munka\Programok\Microsoft Visual
>> >> > Studio
>> >> > 10.0\VC\
>> >> > BIN\amd64\cl.EXE"' : return code '0x2'
>> >> > Stop.
>> >> > E:\Lua\alien>
>> >> > I hope you can help me to make it working :)
>> >> > Thanks in advance,
>> >> > Attila
>> >> > 2011/3/1 Fabio Mascarenhas <mascarenhas@acm.org>
>> >> >>
>> >> >> Commited a patch to github to fix some of the problems below. I
>> >> >> remembered that Windows x64 was officialy unsupported; the latest
>> >> >> version of libffi has support for Windows x64, but I did not have a
>> >> >> machine to test this, so I just made Makefile.win64 so someone with
>> >> >> a
>> >> >> Win64 machine could help me track down the bugs.
>> >> >>
>> >> >> On Tue, Mar 1, 2011 at 10:55 AM, Attila <ejjeliorjarat@gmail.com>
>> >> >> wrote:
>> >> >> > Here is the output:
>> >> >> >
>> >> >> > E:\Lua\alien>nmake /f makefile.win64
>> >> >> >
>> >> >> > Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
>> >> >> > Copyright (C) Microsoft Corporation.  All rights reserved.
>> >> >> >
>> >> >> >        cl /c /MD /Fosrc\alien\core.obj /O2 /DWINDOWS
>> >> >> > /Ic:\usr\local\include
>> >> >> > /Il
>> >> >> > ibffi\win32 src\alien\core.c
>> >> >> > Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for
>> >> >> > x64
>> >> >> > Copyright (C) Microsoft Corporation.  All rights reserved.
>> >> >> >
>> >> >> > core.c
>> >> >> > src\alien\core.c(308) : error C2065: 'FFI_STDCALL' : undeclared
>> >> >> > identifier
>> >> >>
>> >> >> Fixed, libffi for Windows x64 does not define FFI_STDCALL.
>> >> >>
>> >> >> > src\alien\core.c(308) : error C2099: initializer is not a constant
>> >> >> > src\alien\core.c(836) : error C2440: ':' : cannot convert from
>> >> >> > 'void'
>> >> >> > to
>> >> >> > 'const
>> >> >> > char *'
>> >> >> > src\alien\core.c(1060) : error C2440: ':' : cannot convert from
>> >> >> > 'void'
>> >> >> > to
>> >> >> > 'const
>> >> >> > char *'
>> >> >>
>> >> >> These are very odd, because both lines have explicit casts. Could
>> >> >> not
>> >> >> find anything on Google about this being specific behavior of the
>> >> >> cl.exe for Windows x64.
>> >> >>
>> >> >> > src\alien\core.c(1422) : error C2079: 'alienlib' uses undefined
>> >> >> > struct
>> >> >> > 'alienlib
>> >> >> > '
>> >> >> > src\alien\core.c(1422) : error C2078: too many initializers
>> >> >> > src\alien\core.c(1452) : warning C4133: 'function' : incompatible
>> >> >> > types
>> >> >> > -
>> >> >> > from '
>> >> >> > const luaL_reg []' to 'const luaL_Reg *'
>> >> >>
>> >> >> Seems like Lua 5.2 cut support for luaL_reg as an alias for
>> >> >> luaL_Reg,
>> >> >> just changed it to use luaL_Reg.
>> >> >>
>> >> >> --
>> >> >> Fabio Mascarenhas
>> >> >
>> >> >
>> >
>> >
>
>