开发者

DllNotFoundException while trying to "fix" LuaInterface, but why?

Since my game, which I'd really like to be Mono-usable, does not seem to run under Linux because LuaInterface is being a jerk (see the the relevant SO thread for more on that), I've decided to do what's suggested there. I wrote my own Lua511.LuaDLL class to reflect the one used by LuaInterface, replacing every single public function with its respective DllImport from lua51:

//For example, like this:
[DllImport("lua51")]
public static extern IntPtr luaL_newstate();

With the edited LuaInterface.dll (which now hosts its own Lua511.LuaDLL) and a pure, native Win32 lua51.dll in my game's startup folder, I somehow get a DllNotFoundException when LuaInterface tries initialize:

public Lua()
{
   luaState = LuaDLL.luaL_newstate(); //right there, right then.
   ...

Ofcourse, with the DLL right there it shouldn't do that, right? Strangel开发者_StackOverflow社区y, putting back the messed-up .Net version of lua51.dll gives an EntryPointNotFoundException instead. The mind boggles.

So what's up with that?

Relevant source code: Lua511.cs, dropped it in the LuaInterface project, then removed the reference so it'd be replaced.

Edit: Screw this, I'm gonna look for alternatives. Or roll my own. Or just stop caring about Linux compatibility.


You referenced my question. I took the other way to solve the problem and started to develop a new Lua .NET interface. I called it Lua4Net.

You can find the sources on Google hosting. And here the unit tests.

Currently implemented features: Execute code with exception handling and provide the return values; register global functions with parameter handling.

Features that will follow: Get/set global variables; debugging support, ...

You can find the used native windows DLL here (it is the renamed VC++ 9.0 DLL from here).

AND: Today I ran my first Linux/Mono tests, and all my unit tests worked!!!


AFAIK mono uses .so extension for native libraries under Linux by default.

Try to rename your lua51.dll to lua51.so or change dllname in DllImport attribute. Or use dllmap.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜