Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. 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
    Accepted Answer

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


Sign In or Register to comment.