lua-users home
lua-l archive

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


Hi,

Adrian Sietsma wrote:
> I think I've discovered a bug-ette in LuaJIT :
> On Windows, the LuaJIT .exe will happily load an unmodified Lua51.dll, if 
> one is so foolish as to have it on the path, instead of the luajit built 
> dll.

The DLL must have the same name because of the way dynamic
linking works under Windows. All Lua core symbols referenced from
loadable C modules need both a symbol name and a module name. And
the latter has to be "lua51.dll" for both Lua and LuaJIT, so the
same module can be used in both execution environments.

Your best bet is to install the .exe together in the same
directory as the .dll. The standard C path has the .exe directory
in the 2nd place. You could move this to the 1st place (before
the current directory) to make absolutely sure it's checked first
(see LUA_CPATH_DEFAULT in luaconf.h).

> Human error on my part, but a load/runtime check would be nice.

Well, if the failure of require"jit" is not good enough ... Of
course I could reference a symbol in the .dll from the .exe. But
the resulting error might be confusing. Ok, I could name the
symbol "luaJIT_executable_tries_to_load_wrong_lua51_dll".  ;-)

> btw, I'm setting up Lua / LuaSocket / LuaJIT on a twin-xeon box running 
> fedora4 64bit; any hints on optimum compile options ?

Umm, there is no support for x64. But since Linux x64 can run
x86 executables, you should be fine with the default options.
You might need to force use of the 32 bit compiler (gcc -m32).

Bye,
     Mike