Skip to main content
New Participant
August 24, 2014

Use LibOVR with managed c++/cli (VS2012)

Hello colleagues,

I am trying to access the Rift from C# and have written a CLR wrapper with C++/CLI.

Unfortunately, the wrapper assembly will not load into a C# assembly. Runtime error:

"Could not load file or assembly 'Oculus.dll' or one of its dependencies. The specified module could not be found."

The OculusRoomTiny sample in the same solution builds and runs fine, I have copied all include settings to my wrapper.
In my configuration I have set the platform for all projects to x86/WIN32 or x64, respectively. To no avail.

It has been some 7 years since I have programmed in C++, so a lot will have slipped my mind.
Could you please help me with this?

Thanks,

Andreas Hassmann.

    3 replies

    Up and Coming
    August 24, 2014
    When you build your Oculus.dll make sure you include winmm.lib.
    HassmannAuthor
    New Participant
    August 24, 2014
    thanks for pointing in the library direction, jcollins.

    winmm.lib was included, but due to the different approach to resolving dll hell in .NET
    it turned out that you must

    have a copy of the right version (platform) of d3dcompiler_xx.dll present in the executing assembly directory.

    In my case that was

    d3dcompiler_46.dll (VS2012)

    and is probably

    d3dcompiler_47.dll (VS2013)
    HassmannAuthor
    New Participant
    August 24, 2014
    Or, if you are the rather clever type of .NET developer, you just use

    the SharpOVR package by Guy Godin

    which is easily included via NuGet.


    I will just delete my feeble C++ attempts...