GameCTO / luainterface

Automatically exported from code.google.com/p/luainterface
0 stars 0 forks source link

LuaInterface on Mono/Linux cannot load lua51.dll #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Take a binary + LuaInterface.dll + lua51.dll which runs correctly on
.Net/Windows
2. copy them on a linux machine with mono
3. instantiate the "Lua" class

What is the expected output? What do you see instead?

The application terminates ans mono says: "... in assembly lua51.dll
contains native code that cannot be executed by Mono on this platform"

What version of the product are you using? On what operating system?
I used the binaries inside "LuaInterface_2.0.3.7z" and a fresh build of
LuaInterface from the subversion here.
Using a Ubuntu 9.04 x86 Linux.

Original issue reported on code.google.com by ulrich.b...@gmail.com on 7 Oct 2009 at 5:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Supposedly there is a port of LuaInterface for linux (as quoted here:
http://www.mono-project.com/Software)

It links to this project page: http://yanesdkdotnet.sourceforge.jp/ (in 
japanese),
and this file: 
http://yanesdkdotnet.sourceforge.jp/download/lua4yanesdk200701242308v160.zip

I tried the files in this zip to no avail.  Same error.  Send halp.

Original comment by c.r.nov...@gmail.com on 19 Mar 2010 at 8:02

GoogleCodeExporter commented 9 years ago
Have you tried liblua51.so? Delete the dll and put either a symlink or the 
actual .so 
from the lua package on whatever distro (On ubunutu apt-get install lua-5.1) or 
copy 
the liblua51.so to your output directory, Mono should see this and load the SO 
instead.

Original comment by plagueth...@gmail.com on 1 Apr 2010 at 11:46

GoogleCodeExporter commented 9 years ago
I may be doing it wrong, but I just tried your suggestion to no avail.

I tried naming it liblua51.so, liblua5.1.so.0 (its original name), and 
lua51.dll.  In
all cases I used a symlink.  

The error:
~/Debug$ mono WindowsFormsApplication1.exe

** (WindowsFormsApplication1.exe:2380): WARNING **: The following assembly 
referenced
from /home/c/Debug/LuaInterface.dll could not be loaded:
     Assembly:   lua51    (assemblyref_index=1)
     Version:    0.0.0.0
     Public Key: 1e1fb15b02227b8a
The assembly was not found in the Global Assembly Cache, a path listed in the
MONO_PATH environment variable, or in the location of the executing assembly
(/home/c/Debug/).

Files:
lrwxrwxrwx 1 c c   23 2010-04-01 12:16 liblua51.so -> /usr/lib/liblua5.1.so.0
lrwxrwxrwx 1 c c   23 2010-04-01 12:19 liblua5.1.so.0 -> /usr/lib/liblua5.1.so.0
lrwxrwxrwx 1 c c   23 2010-04-01 12:15 lua51.dll -> /usr/lib/liblua5.1.so.0

Any ideas?  Am I simply doing it wrong?

Original comment by c.r.nov...@gmail.com on 1 Apr 2010 at 4:20

GoogleCodeExporter commented 9 years ago
The "lua51.dll" in LuaInterface is compiled by Visual Studio and use the /clr 
options. That's to say the dll is mixed with windows native code and IL 
code.And the native code also has a Visutal Studio CRT dll reference such as 
msvcmt.dll and even windows kernal32.dll.

Because of these, the lua51.dll cannot be used on mono/linux. There are 2 ways 
to resolve it. 
The first is make a linux version C++/CLI compiled lua library, I think GCC 
could handle this.
The second is make a pure IL library version of lua, replace all the CRT calls 
with CLR calls. There is a guide on Homepage of Mono.

Now I'm trying on the second way but I got an error when lua script call C# 
functions that means I couldn't call Managed Code in Unmanaged Code. 
I'm working hard on that

Original comment by Terender...@ifreeteam.com on 25 Oct 2012 at 2:20

GoogleCodeExporter commented 9 years ago
@Terender...@ifreeteam.com

I took another approach, I wrote my own (100% managed) wrapper library around 
the liblua51.dll/liblua51.so:

https://code.google.com/p/parallel-tasks-simulator/source/browse/#svn%2Ftrunk%2F
Src%2FLua4Net

Original comment by ulrich...@gmail.com on 25 Oct 2012 at 8:52