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.

Hololens cannot pinvoke native dll with error "Dll Not Found"


I tried to build a very simple native dll that can be called by a simple UWP c# app with PInvoke. The UWP app can run on normal Windows 10 computer without any problem, but when I deployed the UWP app to a Hololens, it always fails with error "Dll Not Found". I have tested RS4 and RS5 in Hololens and got the same result.

The reproduce steps are very straightforward.

  1. Create a native C++ DLL project ( I am using VS 2017 community version), and write some code like returning 1 + 2, for example:

include "stdafx.h"

extern "C" {

__declspec(dllexport) int __stdcall add12() {

    return 1 + 2;


  1. Create a blank UWP project to call the DLL function with PInvoke:
    public class WrapperClass
    [DllImport("CPPDLL", CallingConvention = CallingConvention.StdCall)]
    public static extern int add12();

public sealed partial class MainPage : Page
public MainPage()

        int result = WrapperClass.add12();

        Debug.WriteLine("add 12 = " + result);

  1. Build and run the UWP application on a Win10 computer and a Hololens, and you will notice that the Win10 computer will succeed to run while the Hololens will fail to run.

Any help is highly appreciated.



Best Answer

  • BinXieBinXie
    Answer ✓

    Got the answer from somewhere else. The problem is about dll dependency. Question closed.


Sign In or Register to comment.