在 Hololens 上的 C# Unity 中找不到模块 C++ .dll
Module not found C++ .dll inside C# Unity on Hololens
我正在尝试为我的项目实施一个简单的 .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的设置和路径:
问题:
我为 x86 编译并成功用于我的 UWP 应用程序的 OpenCV 源文件不知何故不适用于 HoloLens。
已解决:
我为我的 C++ .dll 使用了 NuGet-Package "OpenCV-HoloLens",并将 .dll 也复制到了 Unity。
我正在尝试为我的项目实施一个简单的 .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的设置和路径:
问题: 我为 x86 编译并成功用于我的 UWP 应用程序的 OpenCV 源文件不知何故不适用于 HoloLens。
已解决: 我为我的 C++ .dll 使用了 NuGet-Package "OpenCV-HoloLens",并将 .dll 也复制到了 Unity。