Module not found C++ .dll inside C# Unity on Hololens

2

I'm trying to implement a simple .dll to my Project which will be builded for the HoloLens Augmented Reality Application. I am trying to simply call a function from my C++ .dll to implement an OpenCV Code but on the HoloLens it throws an error shown below.

.dll C++ Code:

extern "C" void __declspec(dllexport) __stdcall test() {
    return;
}

Unity C# Code:

 internal class OpenCV
    {
        // Define the functions which can be called from the .dll.
        [DllImport("Project1")]
        internal static extern void test();

        public static void testmeth()
        {
            test();
        }
    }

Error when Debugging on HoloLens with Visual Studio:

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

Here you can see the Settings and Path of the dll: Here you can see the Settings and Path of the dll

c#
c++
unity3d
dll
hololens
asked on Stack Overflow Feb 5, 2019 by I'm a Car • edited Feb 6, 2019 by I'm a Car

1 Answer

1

Problem: The source files of OpenCV which I compiled for x86 and used successfully for my UWP App somehow didn't work for the HoloLens.

Solved: I used the NuGet-Package "OpenCV-HoloLens" for my C++ .dll and copied the .dlls to Unity as well.

answered on Stack Overflow Feb 7, 2019 by I'm a Car

User contributions licensed under CC BY-SA 3.0