Urko Sanchez Ortiz
Urko Sanchez Ortiz

Reputation: 311

C++ dll in hololens

I am working creating a hololens application using a native code dll based on c ++. The problem comes when I add it in the unity project (plugins / WSA / x86).

When generating the UWP solution in Visual Studio I get a failure of DllNotFound.

From what I have been able to read, it is necessary to create a UWP library to use it in my application. That library must contain my native code. The truth is that I'm not sure how to do that. Is there any way to stop my dll based on c ++ on a UWP dll ??

error: System.DllNotFoundException: Unable to load DLL 'nativoHololensPrueba.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E).

enter image description here

C++

SOURCE:
  #include <iostream>
  #include <stdio.h>
  #include <memory>
  #include "Header.h"

__declspec(dllexport)
int testo() {
return 10;
}

HEADER:
extern "C" {

__declspec(dllexport)
    int testo();
}

c#

[DllImport("nativoHololensPrueba")]
public static extern int testo();

// Use this for initialization

public GameObject texto;


void Start () {
    texto.GetComponent<TextMesh>().text = "Cambiando el nombre " + testo();
}

enter image description here

Upvotes: 3

Views: 1108

Answers (1)

Eusebiu Marcu
Eusebiu Marcu

Reputation: 320

I also had this and I solved it by compiling the dll on ARM64 (or ARM) with /MT flag.

Upvotes: 1

Related Questions