lua-users home
lua-l archive

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


----- Original Message -----
From: Luiz Henrique de Figueiredo
Date: 4/21/2011 11:11 AM
Q4) I found a reference from one of the Lua authours mentioning he had thought about making cross compilation a Luac feature. This would be a useful feature for me personally, is this a likely addition for Lua V5.2 or even V5.3 ?
No, it's unlikely to be added to mainstream Lua. Crosscompiling Lua bytecode
is a lot of work to do it correctly for all platforms. Moreover, it
would place a burden on bytecode loading, whose main goal is speed. It's
usually light work to do crosscompiling for a fixed pair of source-target
platforms. You just need to change some details in ldump.c or lundump.c
(probably the former, to allow full speed loading).
LuaPlus has an lundump.c that handles endian conversion. This has been sufficient to make bytecode load and run on Windows, Mac (PPC and Intel architectures), iOS, Xbox 360, PS3, and Wii. The performance hit is minimal.

https://github.com/jjensen/luaplus51-all/blob/master/Src/LuaPlus/src/lundump.c

Josh