Hello guys,
I'm trying to access my java libraries in a Unity C# project but Unity keeps throwing dll-not-found errors. I'm on Unity Pro 3.5.7 and Mac OS X 10.8.4.
I'm using IKVM to convert java bytecode into .net dll and putting references to those in my Unity project, like the post here, [http://forum.unity3d.com/threads/494...e-inside-Unity][1].
First, I encountered the problem of MonoPosixHelper.dll not found error, which is stated here, [http://forum.unity3d.com/threads/999...lper-not-found][2]. According to Unity's dll map, which can be accessed here on a mac, /Applications/Unity/Unity.app/Contents/Frameworks/Mono/etc/mono/config, I found out that MonoPosixHelper.dll actually means libMonoPosixHelper.dylib, and the problem no longer exists after I made a copy of it into my Unity project folder.
However, another problem appears after this one: DllNotFoundException: msvcrt. According to the same dll map I can see it's actually looking for libc.dylib, so I made a copy of that too, but it doesn't work this time. I tried copying it into my project folder, Assets sub folder, scripts sub folder and /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib folder but none of those worked.
My java library runs well with a standalone Xamarin Studio C# project so I believe it's something weird Unity did with its Mono library.
Does anyone have the same problem or has any ideas on where Unity actually looks for native dlls? (I think libMonoHelper.dylib is native too because it appeared in the library folder of Unity app's content folder, and that makes me wonder why Unity does not recognize that library in the first place)
Here is a copy of my error message.
----------
DllNotFoundException: msvcrt
Mono.Unix.Native.Syscall.CopyUtsname (Mono.Unix.Native.Utsname& to, Mono.Unix.Native._Utsname& from)
Mono.Unix.Native.Syscall.uname (Mono.Unix.Native.Utsname& buf)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
ikvm.internal.MonoUtils.unameProperty (System.String )
ikvm.internal.Util..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for ikvm.internal.Util
java.lang.VMSystemProperties.getLibraryPath ()
java.lang.VMSystemProperties.initCommonProperties (java.util.Properties )
java.lang.VMSystemProperties.initProperties (java.util.Properties )
java.lang.Props..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for java.lang.Props
java.lang.System.lineSeparator ()
sun.misc.VM..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for sun.misc.VM
java.nio.Bits..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for java.nio.Bits
java.nio.ByteBuffer..ctor (Int32 , Int32 , Int32 , Int32 , System.Byte[] , Int32 )
java.nio.HeapByteBuffer..ctor (Int32 , Int32 )
java.nio.ByteBuffer.allocate (Int32 capacity)
net.named_data.jndn.util.Blob..ctor (System.Int32[] value)
TestEncodeDecodeInterest.Test () (at Assets/Scripts/init.cs:81)
init.Start () (at Assets/Scripts/init.cs:128)
========================================
[1]: http://forum.unity3d.com/threads/49483-Ideas-needed-for-debugging-using-Java-code-inside-Unity
[2]: http://forum.unity3d.com/threads/99951-MonoPosixHelper-not-found
↧