Skip to main content
Up and Coming
April 19, 2014

SDK 0.3.1 and compiling LibOVR to DLL

So I've been able to tweak the LibOVR project so that it compiles to a DLL rather than a static library. To do this I've added the following dependencies in Linker->Input->Additional Dependencies:

    msvcrt.lib (msvcrtd.lib for debug)
    winmm.lib
    setupapi.lib


I've also changed the Target Name to be libovr for both Win32 and x64 platforms. The reason I'm doing this is to be able to P/Invoke LibOVR from C# and I want it to work with AnyCPU (I'm loading the appropriate Win32/x64 library manually). I'm developing a .NET wrapper (which I intend to release as a NuGet package) and wanted to use the new C API rather than wrap the C++ classes in CLI/C++ like RiftDotNet does so that its easier to maintain.

So far so good but I was wondering if there were any plans to release LibOVR as a DLL rather than a static lib in the future? (I'm not a big fan of changing project properties, and I think it goes against the terms and conditions of the license).

I also had to change the OVR_EXPORT definition as it did not export with x64


#if defined(WIN32)
#define OVR_EXPORT __declspec(dllexport)
#else
#define OVR_EXPORT // Before
#define OVR_EXPORT __declspec(dllexport) // After
#endif


Thanks!
Guy

    14 replies

    Inspiring
    July 25, 2014
    "PathogenDavid" wrote:
    Of course, everyone is probably better off going off of jherico's repo once he updates it. ;)


    SHAZAM!
    Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action
    Participant
    July 25, 2014
    Very speedy, jherico! I should've looked for another branch, thanks!
    Inspiring
    July 25, 2014
    "PathogenDavid" wrote:
    Very speedy, jherico! I should've looked for another branch, thanks!


    Actually I'd made the change earlier, but hadn't committed and pushed to the repository until just after I read your post. I figured if people were actually looking for this functionality I should get off my ass and handle it.

    Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action
    guygodinAuthor
    Up and Coming
    July 25, 2014
    I noticed that they messed up the dll export again in x64, maybe they'll get right the 3rd time? :D
    I also got the error with WinSock but didn't get any linking errors with GDI though.

    The SharpOVR NuGet should be updated by tomorrow.
    Virtual Desktop Developer