Lua File System DLL Not Valid

432 Views Asked by At

Pretty new to the LUA environment, so hopefully i'm just missing something really small. I've been trying to compile LuaFileSystem using LuaRocks and MinGW. After having finally compiled it, I am trying to load the DLL using

require("lfs")

and

local f = assert(package.loadlib("lfs.dll","lfs"))
lfs = f()

And I keep getting this error

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: error loading module 'lfs' from file '.\lfs.dll':
    %1 is not a valid Win32 application.

    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)

A couple points to note is that I'm trying to utilize this DLL in the Eclipse LDT Interpreter. The DLL is compiled against LUA 5.1 and Eclipse is using LUA 5.1. Any ideas what I'm doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

So it turns out, I failed to realize that the LDT for Eclipse includes an embedded version of Lua based on jnLua. Using LuaRocks, I compiled against the included version with LuaRocks which is more vanilla lua.

I'm sure there's a way to resolve this by setting LuaRocks to use the jnLua interpreter, but the quicker method was just to add the LuaRocks included version as the interpreter used in Eclipse.

In Preferences, Lua->Interpreters, Add a new one. For the executable just navigated to the included LuaRocks Lua interpreter (lua5.1.exe). Once I updated my run profiles to use this new interpreter, it worked fine.