2009-10-07 71 views
5

当我试图在Linux上单用LuaInterface(在Ubuntu 9.04使用单声道2.0)我得到以下异常:如何使用LuaInterface在Mono/Linux的

 
** (App.exe:8599): WARNING **: Method ':.DoDllLanguageSupportValidation()' in assembly 
'/home/ulrich/test/Debug/lua51.dll' contains native code that cannot 
be executed by Mono on this platform. 
The assembly was probably created using C++/CLI. 

根据this web site LuaInterface 可以是与Mono一起使用。 MoMA也是这样说的。

是否可以重新编译lua51.dll以使其与Mono兼容?

回答

6

LuaInterface看起来是纯粹的C#,但它使用了混合模式本地Lua库的Windows版本的C++/CLI版本,混合了.NEt代码和本机32位Windows代码。除了Windows以外,没有其他平台的C++/CLI编译器,因此无法移植/重新编译C++/CLI代码,尽管它应该适用于Win32上的Mono(或者Wine)。

唯一真正可行的方法为了在Mono上运行,可以使用P/Invokes而不是C++/CLI。然后,您可以使用dllmap,这样当Mono尝试解析lua51.dll的P/Invoke调用时,它将被重定向到与Linux等效的liblua.so.5.1。

+0

问题是,lua51.dll不使用DLLImport(),但编译非托管的Lua代码直接到这个托管库。 – ulrichb 2009-10-07 22:16:31

+0

哎呀,应该仔细看过LuaInterface模式。编辑为使其正确。 – 2009-10-07 23:44:03

+0

这听起来不太好,因为http://luainterface.googlecode.com/svn/trunk/lua-5.1.2/lua511/LuaDLL.cpp似乎做了很多“魔术”,...而且, ....为什么没有混合的C++/CLI编译器? – ulrichb 2009-10-08 10:59:05