RE: The dreaded newbie questions...

  • From: Thomas Buergel <Thomas.Buergel@xxxxxxxxxx>
  • To: "luajit@xxxxxxxxxxxxx" <luajit@xxxxxxxxxxxxx>
  • Date: Wed, 17 Oct 2012 17:04:56 +0000

>On Tue, Oct 16, 2012 at 10:55 PM,  <mchalkley@xxxxxxxx> wrote:
>> If I modify the folder that the program runs fine in, using lua.exe 
>> (5.1.5), replace lua.exe with luajit.exe, replaced lua51.dll with the 
>> luajit one (...)
>
> My guess is that it has something to do with the way that Lua 5.1 binaries
> packages on Windows often have a lua51.dll that is actually only a thin proxy
> for a lua5.1.dll, so when you replace lua51.dll with LuaJIT's you are only
> replacing the proxy -- and any C module that was linked against "lua5.1"
> instead of "lua51" will end up trying to use the Lua 5.1 codebase to deal
> with a LuaJIT 2.0 state...

I have battled the same problem.

How to generate a proxy DLL lua5.1.dll from a built lua51.dll (assuming Visual 
Studio build environment):

Given the build output with the following files:
- lua51.dll
- lua51.lib
- lua51.exp

Then, invoke the following from a Visual Studio command-line:

> link /dll /noentry /nodefaultlib /out:lua5.1.dll lua51.lib lua51.exp

Output:
This generates a lua5.1.dll that is a proxy for lua51.dll.

Haven't tried it yet, but in theory it should work...

Of course, this dual lua51.dll and lua5.1.dll madness should just stop. Until 
it has, and people want to retrofit, e.g., a LuaForWindows setup, this might be 
a practical solution.

Tom



Other related posts: