Skip to main content
New Participant
April 20, 2016
Solved

ovr_Initialize() returning ovrError_LibLoad

  • April 20, 2016
  • 3 replies
  • 1938 views
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.)
    Best answer by philb
    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.

    Thanks.

    3 replies

    Inspiring
    April 20, 2016
    I believe this is a path issue. You can just restart your computer and you should be OK.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    philbAuthor
    New Participant
    April 21, 2016
    I've restarted my computer. It still behaves the same way.
    philbAuthorAnswer
    New Participant
    April 21, 2016
    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.

    Thanks.