HoloLens : Deploy app with custom dll's through Unity

1

I have a Unity project in which I have to do image processing stuff. I chose to use C++ Opencv 3.4 so I created a Visual Studio C++ project, build a Universal Windows Plateform (UWP) dll and wrap + link it in my C# scripts. It works just fine in the Unity Editor with the following architecture Unity Project Plugin but I can't manage to deploy the application on the HoloLens nor on the emulator.

I've build both 64 and 32 bits versions of opencv and of my dll. I've setup Unity Editor to use the 64bits version and the WSA plateform to use the 32 bits one as you can see on the following screenshots Unity Plugin Settings x64 / Unity Plugin Settings x86.

I've build the Unity project with the following settings Unity build.

When I get into visual studio and deploy the app to the HoloLens I get the following errors on every custom dll that I've added to the project

...
Loading opencv_highgui340.dll
Failed to load 'opencv_highgui340.dll', expected x86 architecture, but was Unknown architecture. You must recompile your plugin for x86 architecture.

(Filename: C:\buildslave\unity\build\Runtime/Misc/Plugins.cpp Line: 150)


Loading DocDetector.dll 
Failed to load 'DocDetector.dll', expected x86 architecture, but was Unknown architecture. You must recompile your plugin for x86 architecture.

Which result in when deploying and launching the app on the HoloLens:

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

Please found below the C# script that loads and calls the dll (just in case):

// How I import the dll
internal static class OpenCVInterop
{
    [DllImport("DocDetector")]
    internal unsafe static extern double SimpleDocumentDetection(ref Color32 image, uint width, uint height, ref byte result);
}

// ...

// How I use it
unsafe
{
    duration = OpenCVInterop.SimpleDocumentDetection(ref image[0], width, height, ref result[0]);
}

Thank you in advance ;)

c#
c++
opencv
unity3d
hololens
asked on Stack Overflow Feb 12, 2018 by Arnaud Delpeyroux • edited Feb 13, 2018 by Dmitrii Z.

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0