LuaJIT

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

LuaJIT

Adrian Sietsma
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.

This caused much head scratching, when require"jit" failed from the luajit
console...

Human error on my part, but a load/runtime check would be nice.
(ps - this is not a criticism; I like luajit a lot)

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

Adrian
Reply | Threaded
Open this post in threaded view
|

Re: LuaJIT

Mike Pall-4-2
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
Reply | Threaded
Open this post in threaded view
|

Re: LuaJIT

Dave Dodge
On Tue, Apr 11, 2006 at 02:00:05PM +0200, Mike Pall wrote:
> 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).

BTW some Linux distributions are better at that than others.  Fedora's
probably okay, but for example Ubuntu x86_64 makes things a bit
difficult: they don't have 32-bit versions of all of their libraries
and I think their normal gcc has 32-bit output disabled.

                                                  -Dave Dodge