Compiled Lua scripts and incompatibilities with different OS and Cpus
 

Compiled Lua scripts and incompatibilities with different OS and Cpus

Started by PPK, 08 August, 2009, 00:23:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PPK

Few weeks ago someone have problem with compiled script on 32bit system that was not working for unknown reason on 64bit version. I don't know why it was not working, but today on lua mailing list was some info about that problem. So here it is, why compiled lua script is not working on different OSes and Cpu architectures.
QuotePrecompiled chunks are dependant upon several factors:
* Lua version
* Endianness
* sizeof(int)
* sizeof(size_t)
* sizeof(Instruction) (which is typically a typedef onto lu_int32)
* lua_Number type
What that means ?
1) Lua script compiled with 32bit x86 lua should work with 32bit x86 PtokaX on windoze, linux or freebsd (that is where i know that PtokaX is working). It will not work with any 64bit amd64 version. On windoze because size_t have different sizes. On linux and freebsd because int and size_t have different sizes.
2 ) Lua script compiled with 64bit amd64 lua on windoze will work only with 64bit amd64 PtokaX on windoze. It will not work on 32bit version for same reasons as above. And it should not work on linux or freebsd because theyr int is 64bit when windoze have int always 32bit.
3 ) Lua script compiled with 64bit amd64 lua on linux or freebsd will work only with 64bit amd64 PtokaX on linux or freebsd. Again it will not work on 32bit and should not work on 64bit amd64 PtokaX on windoze.
Any other Oses or Cpu architectures probably have similar or more reasons why compiled script will not work ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

SMF spam blocked by CleanTalk