Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use LuaInterface on Mono/Linux

When I try to use LuaInterface on Mono on Linux (using Mono 2.0 on Ubuntu 9.04) I get the following exception:

** (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.

According to this web site LuaInterface can be used with Mono. MoMA says that too.

Is it possible to recompile lua51.dll to make it compatible to Mono?

like image 559
ulrichb Avatar asked Oct 07 '09 19:10

ulrichb


2 Answers

LuaInterface looks to be pure C#, but it uses a mixed mode C++/CLI-ified version of the Windows version of the native Lua library, that mixes .NEt code and native 32-bit Windows code. There's no C++/CLI compiler for platforms other than Windows, so you can't port/recompile the C++/CLI code, though it should work on Mono on Win32 (or maybe Wine)..

The only really viable way to get this to work on Mono would be to make it use P/Invokes istead of C++/CLI. You could then use a dllmap so that when Mono tries to resolve the P/Invoke calls to lua51.dll, it is redirected to the Linux equivalent, liblua.so.5.1.

like image 114
Mikayla Hutchinson Avatar answered Oct 18 '22 13:10

Mikayla Hutchinson


Older versions of LuaInterface use a pure P/Invoke wrapper. You could use this.

There are also a few attempts at alternatives, my own included. http://github.com/jsimmons/LuaSharp

like image 29
jsimmons Avatar answered Oct 18 '22 14:10

jsimmons