I'm migrating my C++ OpenGL application from OculusSDK version 0.7 to SDK 1.3, and I'm running into an issue with ovr_Initialize(). It is returning ovrError_LibLoad (-3001). I didn't have this problem with the previous versions of the SDK and Oculus Runtimes.
I've installed the Oculus Home application (OculusSetup.exe), which includes the runtime DLLs I need. They are located at C:\Program Files\Oculus\Support\oculus-runtime
ovr_Initialize() is calling OVR_LoadSharedLibrary() which calls OVR_FindLibraryPath() which calls SearchPathW(). SearchPathW() isn't finding that path (C:\Program Files\Oculus\Support\oculus-runtime\LibOVRRT64_1.dll) in my application.
If I copy LibOVRRT64_1.dll and LibOVRRT32_1.dll into the directory with my application executable, then it works just fine.
When I run the sample application (OculusRoomTiny (GL)), it finds the directory just fine. When I debug it, everything seems to be executing the same as my application, except that SearchPathW finds the correct path for OculusRoomTiny, but doesn't return anything in my application.
Am I missing something? Is there something else I need to do in my application solution so that it can find the DLLs?
I don't understand how SearchPathW() is actually finding that directory. The comment in the code says, "// No directory, which causes Windows to use the standard search strategy to find the DLL."
How does Windows standard search strategy find a DLL in the directory "C:\Program Files\Oculus\Support\oculus-runtime"? Why does it work with the sample, but not my own application?
I'm confused.
(In case it matters, I'm using Visual Studio 2013.)
I think I've figured out what is happening. The path to the oculus runtime directory is being stored in the PATH system environment variable, which is part of the standard DLL search order (https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586).
We're calling LoadLibraryEx(), which is changing the default DLL search order.
Now that I see how Oculus is finding that path, I think I can figure out how to change my application back to the default DLL search order so that it will load properly.
I think I've figured out what is happening. The path to the oculus runtime directory is being stored in the PATH system environment variable, which is part of the standard DLL search order (https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586).
We're calling LoadLibraryEx(), which is changing the default DLL search order.
Now that I see how Oculus is finding that path, I think I can figure out how to change my application back to the default DLL search order so that it will load properly.