单声道无法加载dll [英] Mono fails to load a dll
问题描述
我正在尝试通过P/Invoke加载使用本机共享库.但是,它不会从MonoDevelop下加载.这是带有MONO_LOG_LEVEL=debug
和MONO_LOG_MASK=dll
的控制台输出:
I am trying to load use a native shared library via P/Invoke. However, it won't load from under MonoDevelop. This is the console output with MONO_LOG_LEVEL=debug
and MONO_LOG_MASK=dll
:
Creating a V8Engine instance ...Mono: DllImport attempting to load: 'V8_Net_Proxy'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy': '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy.so': 'libv8-x64.so: cannot open shared object file: No such file or directory'.
但是,libv8-x64.so
与libV8_Net_Proxy.so
位于同一目录:
However, the libv8-x64.so
is located in the same directory as libV8_Net_Proxy.so
:
/localhome/rryk/v8netmonolinux/Source/bin/Debug [mono-linux *]$ ls
libV8_Net_Proxy.so V8.Net.Console.exe.config V8.Net.dll.mdb V8.Net.Proxy.Interface.x64.dll V8.Net.SharedTypes.dll.mdb x64
libv8-x64.so V8.Net.Console.exe.mdb V8.Net.Proxy.Interface.dll V8.Net.Proxy.Interface.x64.dll.mdb V8.Net.SharedTypes.XML x86
V8.Net.Console.exe V8.Net.dll V8.Net.Proxy.Interface.dll.mdb V8.Net.SharedTypes.dll V8.Net.XML
更有趣的是,从控制台执行时,相同的应用程序也可以很好地加载库:
Even more interesting is that the same very application loads the library just fine when executed from the console:
/localhome/rryk/v8netmonolinux/Source/bin/Debug [mono-linux *]$ MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll mono V8.Net.Console.exe
Creating a V8Engine instance ...Mono: DllImport attempting to load: 'V8_Net_Proxy'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy': '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy: cannot open shared object file: No such file or directory'.
Mono: DllImport loaded library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy.so'.
我还检查了控制台和MonoDevelop中是否使用了相同的mono二进制文件.实际上,我无法检查MonoDevelop使用哪个二进制文件,但是设置中的.NET Runtimes部分显示版本3.0.12.在具有此版本的系统中,我只有一个Mono二进制文件,它是默认情况下在命令行上使用的一个(因为它在whichis
中首先列出):
I also checked that the same mono binary is used both on the console and in MonoDevelop. In fact I couldn't check which binary is used by MonoDevelop, but .NET Runtimes section in the settings displays version 3.0.12. I only have one Mono binary in the system which has this version and it is the one used on the command line by default (as it's listed first in whichis
):
~$ whereis mono
mono: /usr/bin/mono /etc/mono /usr/lib/mono /usr/bin/X11/mono /usr/local/bin/mono /usr/local/etc/mono /usr/local/lib/mono /usr/share/mono /usr/share/man/man1/mono.1.gz
什么会引起差异?为什么Mono无法找到位于同一目录中的libv8-x64.so
?
What can cause the difference? Why doesn't Mono find the libv8-x64.so
, which is located in the same directory?
推荐答案
尝试:
LD_LIBRARY_PATH=`pwd` mono V8.Net.Console.exe
这篇关于单声道无法加载dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!