Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How to integrate a native C++ plugin for Unity HoloLens project

I'm trying to figure out how to integrate some C++ code in a Unity HoloLens project but am having some difficulties. For now it's just some test code that receives and spits out a value, nothing fancy yet.

The C++ code works fine in the Unity editor and works when building a regular x86 or x64 executable. But I have no idea how to get it to work in a HoloLens UWP build, using the existing x86 dll doesn't seems to do anything at all when I run the Unity build in the HoloLens Emulator.

Do I need to compile the C++ code in a special way for UWP?
Or can I use the existing x86 dll by doing some magic in either Unity or the final UWP build in Visual Studio?

Any ideas?

Tagged:

Best Answer

Answers

  • Options

    UWP projects should only have references to UWP compatible libraries. It just makes things easier. I'd add a new C++ UWP class library project to your C# unity project, and then add a reference to it.

  • Options
    james_ashleyjames_ashley ✭✭✭✭

    @Jasper,

    Figures you'd be the one to ask the Unity UWP interop question. It was only a matter of time. :wink:

    Though not specifically for hololens, this looks like it addresses this topic at around 44 minutes.

    The presenter is Adam Tuliper.

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

  • Options

    Thanks for the link, will definitely look at that in depth!
    Hehehe, yeah well some of the cool stuff is still best to do in native C++ I guess :)

  • Options

    Well I don't normally make UWP apps, just win32 desktop apps :)

    Looks like I can link in static C++ libraries into a UWP app.
    Except when I do it with the library I'm currently looking at (ZeroMQ) it appears to fail to eventually load in Unity, possibly due to the library's dependency on kernel32.lib, or something else I'm not aware of just yet.

Sign In or Register to comment.