【问题标题】:Module not found C++ .dll inside C# Unity on Hololens在 Hololens 上的 C# Unity 中找不到模块 C++ .dll
【发布时间】:2019-02-05 20:53:00
【问题描述】:

我正在尝试为我的项目实现一个简单的 .dll,该项目将为 HoloLens 增强现实应用程序构建。我试图简单地从我的 C++ .dll 调用一个函数来实现 OpenCV 代码,但在 HoloLens 上它会引发如下所示的错误。

.dll C++ 代码:

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

Unity C# 代码:

 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();
        }
    }

使用 Visual Studio 在 HoloLens 上进行调试时出错:

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

这里可以看到 dll 的设置和路径:

【问题讨论】:

    标签: c# c++ unity3d dll hololens


    【解决方案1】:

    问题: 我为 x86 编译并成功用于我的 UWP 应用程序的 OpenCV 源文件不知何故不适用于 HoloLens。

    已解决: 我为我的 C++ .dll 使用了 NuGet 包“OpenCV-HoloLens”,并将 .dll 也复制到了 Unity。

    【讨论】:

      猜你喜欢
      • 2018-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-22
      • 2021-10-18
      • 2016-11-20
      • 2019-03-28
      相关资源
      最近更新 更多