简体   繁体   中英

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

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: 在这里可以看到dll的设置和路径

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM