c# - 在 Hololens 上的 C# Unity 中找不到模块 C++ .dll
问题描述
我正在尝试为我的项目实现一个简单的 .dll,该项目将为 HoloLens 增强现实应用程序构建。我试图简单地从我的 C++ .dll 调用一个函数来实现 OpenCV 代码,但在 HoloLens 上它会引发如下所示的错误。
.dll C++ 代码:
extern "C" void __declspec(dllexport) __stdcall test() {
return;
}
统一 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)'
解决方案
问题:我为 x86 编译并成功用于我的 UWP 应用程序的 OpenCV 源文件不知何故不适用于 HoloLens。
已解决:我为我的 C++ .dll 使用了 NuGet-Package“OpenCV-HoloLens”,并将 .dll 也复制到了 Unity。
推荐阅读
- python - 如何防止我的 HBar 在 Bokeh 中重叠?
- javascript - TypeError: params[item].split 不是函数
- c# - C# MVVM - 如何防止多个组合框选择中的重复内容?
- c# - 如何在 .NET 中使用来自 VB6 dll 的方法?
- android - 从 Play 商店更新 android 应用程序后 Firebase Permisson 被拒绝
- powershell - 导入 CSV 的 Powershell 脚本,将信息与 Active Directory 进行比较,按 OU 对其进行排序,然后将信息导出到 csv
- node.js - Nginx 拒绝连接 AWS EC2
- java - 合并两个 XSSFWorkbook
- excel - 选择数据透视表行和列
- python-3.x - 带有 isalpha() 的波浪号 TRUE 返回 -2 而不是 FALSE