[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT library syncing
- From: Mike Pall <mikelu-0812@...>
- Date: Fri, 19 Dec 2008 08:21:26 +0100
Andrew Wilson wrote:
> I wanted to load the plain lua51.dll to avoid duplicating lua51.dll.
> So if I'd like to have only one lua51.dll, is it best to just
> substitute lua51.dll from LuaJIT compilation or statically link LuaJIT
> or have LuaJit check version of plain lua51.dll directly?
Err, I think you're missing something important. The DLL contains
the VM, not the EXE! Both lua.exe and luajit.exe are only small
programs (~10K) that parse the command line and invoke the Lua VM
(luajit.exe offers a couple more options).
The lua51.dll of both VMs are *different* (check the file sizes).
In the case of LuaJIT it also contains the JIT compiler, which is
an unseparable part of the VM.
The DLL of both VMs must have the same name, because all C modules
reference it. All lua_*/luaL_* symbols are tagged during linking
with the DLL they resolve with, i.e. "lua51.dll".
You cannot load both DLLs in the same process. And you cannot
statically link LuaJIT because then all C modules would implicitly
load the other DLL and call its functions -- chaos ensues.
> The directory structure, lua modules, lua files, examples, docs etc
> already exist in Lua for Windows setup. What is your opinion on how
> LuaJIT would best be included in a Lua distribution?
It's a drop-in replacement. So just remove lua.exe/lua51.dll and
replace with the luajit.exe/lua51.dll from LuaJIT. Add the files
from jit/*.lua to the Lua module directory. Explain to users they
should invoke "luajit -O foo.lua" instead and that's it.
Note that you can turn off the JIT compiler with -j off, if needed.
Then you end up with more or less the same VM as used by Lua 5.1.4
plus the Coco patchset. (Not that there's a good reason to do so,
except for debugging.)