opentk / rift

Cross-platform Oculus Rift bindings for .Net and Mono
26 stars 9 forks source link

System.DllNotFoundException: Unable to load DLL 'OVR': The specified module could not be found. (Exception from HRESULT: 0x8007007E) #6

Closed Airstriker closed 10 years ago

Airstriker commented 10 years ago

Added your package (windows) via nuget in xamarin 5.1. Added the test code to my project to main method:

using (var oculus = new OculusRift()) { Console.WriteLine(oculus.Orientation); }

Getting error on runtime: System.DllNotFoundException: Unable to load DLL 'OVR': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

thefiddler commented 10 years ago

You need to add at least one platform package. For windows, this is OpenTK.Rift.Windows.

Airstriker commented 10 years ago

Adding OpenTK.Rift.Windows... Attempting to resolve dependency 'OpenTK.Rift (≥ 1.0)'. Attempting to resolve dependency 'OpenTK (≥ 1.1.1500)'. glomp already has a reference to 'OpenTK.Rift.Windows 1.1.1529.101'.

OpenTK.Rift.Windows successfully added.

I had it already added. Still the same issue.

Airstriker commented 10 years ago

Just a guess... Aren't you missing an entry for windows in OpenTK.Rift.dll.config ?

thefiddler commented 10 years ago

No, dll.config files are only used on Mono, the Microsoft runtime simply ignores them.

Xamarin Studio has a bug where it is not executing post-build events by default. Open your project properties, navigate to to Build -> General and enable the Use MSBuild build engine (recommended for this project type) option.

Rebuild your project and verify that OpenTK.Rift.dll is copied into the correct folder in your application directory.

Airstriker commented 10 years ago

This option was already selected in my project properties. Target framework is Mono /.Net 4.5. After project building OVR.dll file is copied to: bin\Debug\lib\x86\ bin\Debug\lib\x64\ or bin\Release\lib\x86\ bin\Release\lib\x64\

OpenTK.Rift.dll is copied to: bin\Debug\ or bin\Release\

However, still on runtime I'm getting this DllNotFoundException.

thefiddler commented 10 years ago

Thanks for testing. According to MSDN, error 0x8007007E means that some required dependency is missing.

The most likely issue is that you do not have the vs2013 redistributable package installed. You can download that from microsoft.com, or you can rebuild OpenTK.Rift from source using the compiler installed in your system (requires Visual Studio).

Airstriker commented 10 years ago

How did you figured that out ?:) It worked - got missing vs2013 redistributable. Thank you so much! Keep up the great work!

thefiddler commented 10 years ago

Thanks for verifying. This is a common issue when deploying native code - the correct C runtime environment has to be installed, otherwise the program will fail to run (or misbehave in interesting ways.)