LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-14-2016, 06:45 AM   #1
ashokbugude
LQ Newbie
 
Registered: May 2016
Posts: 6

Rep: Reputation: Disabled
Linux : Unity3d DllImport (“filename”) not working


I have imported "Kinect with OpenNI2"( https://www.assetstore.unity3d.com/en/#!/content/10693) from Unity Asset store. When I run the code , I get below error message
...................................................................
System.DllNotFoundException: UnityInterface2
at (wrapper managed-to-native) KinectWrapper:Init (bool,bool,bool) at KinectManager.Start () [0x00000] in /home/ashok/New Unity Project/Assets/KinectScripts/KinectManager.cs:657
UnityEngine.Debug:LogError(Object) KinectManager:Start() (at Assets/KinectScripts/KinectManager.cs:808)
..................................................................
The error message is generated when below code is executed

[DllImport("UnityInterface2", SetLastError=true)]
public static extern int Init(bool isInitDepthStream, bool isInitColorStream, bool isInitInfraredStream);

.......................................................................

I have found below things

[DllImport("UnityInterface2", SetLastError=true)] ------- not working
[DllImport("UnityInterface2.dll", SetLastError=true)] ------- not working
[DllImport("UnityInterface2.dylib", SetLastError=true)] ------- not working
[DllImport("UnityInterface2.so", SetLastError=true)] ------- working but do not want to use it ( unreferenced symbols as I am unable to compile the .cpp and .h files properly from https://github.com/rfilkov/OpenNi2UnityInterface to generate .so file)

..............................................................................

UnityInterface2.dll and UnityInterface2.dylib are proper compiled files, but unable to use

Last edited by ashokbugude; 05-14-2016 at 09:46 PM. Reason: Added more description
 
Old 05-14-2016, 11:17 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
can you explain what you are doing

from what i see you are using apple osx "xcode" to run Microsoft software on linux
???
and that makes zero sense
 
Old 05-15-2016, 12:37 AM   #3
ashokbugude
LQ Newbie
 
Registered: May 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
Aim : To do gesture recognition (hand tracking) on Linux

Hardware : Kinect xbox360

Softwares : Linux,OpenNI2, NiTE2

Unity Package used : Kinect with OpenNI2 (https://www.assetstore.unity3d.com/en/#!/content/10693)


Existing things about the package (code ):Its meant for windows OS and Osx (Apple)
(Package contains UnityInterface2.dll (Windows) and libUnityInterface2.dylib(OsX))
(Package does not contain UnityInterface2.so (Linux))

Existing Platform dependency code :
.....Platform Independent C# code (specifying location of OpenNI2/NiTE2 installation directories(OsX/Linux)..............

If(OS == WIndows OS )
use UnityInterface2.dll library [DllImport("UnityInterface2.dll")] ;

else if (OS == OsX )
use libUnityInterface2.dylib library; [DllImport("libUnityInterface2.dylib")] ;


......... Platform Independent C# code (calling functions in library ) ..............

Requirement : To modify the code to make it work with Linux in following ways

1. Use the existing library files (.dll and .dylib ) and call its functions, ie

If( OS == Linux ) use UnityInterface2.dll library; [DllImport("UnityInterface2.dll")]---- (NOT WORKING))

OR

If( OS == Linux ) use libUnityInterface2.dylib Library [DllImport("libUnityInterface2.dylib")](NOT WORKING))


2. Create a .so file (UnityInterface2.so) by compiling the .h and .cpp files in https://github.com/rfilkov/OpenNi2UnityInterface location and use the following code

If( OS == Linux ) use libUnityInterface2.so Library [DllImport("libUnityInterface2.so")]


Result : unreferenced symbols as I am unable to compile the .cpp and .h files properly


Basically Trying to use 1st option, ie to make Linux identify .dll or .dylib files)
 
Old 05-15-2016, 12:43 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
unless you MUST USE this Microsoft owned C# code ( requiring MONO on linux to replace "Microsoft Dot Net Framework")
and getting Apples Xcode working on linux

i would look at using OpenCV
it already is linux code

and as far as i know opencv has been used with a MS kinetic for image registration tracking
 
Old 05-16-2016, 08:14 AM   #5
ashokbugude
LQ Newbie
 
Registered: May 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi ,

Can I know if I understood correctly ?

Do I need to replace the '4.5' folder at /usr/bin/mono/lib/ of Linux with '4.5' at C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\ of Windows ?
...................................................................................

I found one thing in Linux

Unity/C# is able to recognize independent .dll files ie
If dll A is not dependent on any other dlls it is recognized

Unity/C# is not able to recognize dependent .dll files ie
If dll A is not dependent on dll B,dll C,dll D etc then dll A is not recognized, although all the 4 dlls( A,B,C,D dlls ) are in same location


.................................................................................................... .....

I have used dependency Walker for UnityInterface2.dll and found out that it depends on OpenNI2.dll, NiTE2.dll, msvcp90d.dll and kernel32.dll. I have placed all of these in project folder of Unity and also in 4.5 folder , but the issue still persists.

Can I know how do I make C# code recognize a dll (UnityInterface2.dll) which depends on other dlls
(OpenNI2.dll, NiTE2.dll, msvcp90d.dll and kernel32.dll) in Linux ? Please help

Last edited by ashokbugude; 05-16-2016 at 08:18 AM.
 
  


Reply

Tags
dll, linux, monodevelop, unity



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Unity3D working on SDL, Wayland and Mir support LXer Syndicated Linux News 0 05-11-2016 04:54 PM
Getting ADB working through Wine? (For Unity3D, that's why) Abscissa256 Linux - Software 1 11-08-2014 05:37 AM
LXer: Unity3D game engine 4.0 with linux publishing now available! LXer Syndicated Linux News 0 11-15-2012 03:00 PM
LXer: Unity3D Demo Already Working in Linux, Thanks to Native Client LXer Syndicated Linux News 0 12-14-2011 11:31 AM
__declspec(dllimport) phoenix_fei Programming 4 01-12-2005 08:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration