Unity DLL在加载ARM64时找不到

huangapple go评论92阅读模式
英文:

Unity DLL could not be found when loading on ARM64

问题

在我的Unity项目中,我有两个版本的自定义DLL,一个是针对x86架构的,另一个是针对ARM64架构的(分别用于Unity编辑器和目标设备)。

x86的DLL按预期工作,但是当部署到我的ARM64设备(Hololens 2)时,我收到以下错误消息:

DllNotFoundException: 无法加载DLL 'OpenCV_ImageProcessing_ARM64'。尝试加载以下动态库时出错:由于“无法打开请求的动态库(0x06000000)-无法找到指定的模块。 (WinError:0000007e) at InspectionMenu.processCrack (UnityEngine.Color32[]& raw, System.Int32 width, System.Int32 height) [0x00000] in <00000000000000000000000000000000>:0 at InspectionMenu.Update () [0x00000] in <00000000000000000000000000000000>:0

这些DLL根据正在运行的系统进行导入,这正如预期的那样。

    #if UNITY_EDITOR
        [DllImport("CrackDetection")]
        public static extern void processCrack(ref Color32[] raw, int width, int height);
    #else
        [DllImport("OpenCV_ImageProcessing_ARM64")]
        public static extern void processCrack(ref Color32[] raw, int width, int height);
    #endif

我将这两个DLL都放在了Assets/Plugins文件夹中,并且名称是正确的。我已经查看了DLL的其他依赖项是否通过Dependencies找不到,并将位于下图所示位置的ARM64 OpenCV DLLs添加到相同的Assets/Plugins文件夹中,但仍然没有成功。我不确定是否还需要添加MSVCP140.dllVCRUNTIME140.dll,但我不知道在哪里可以找到它们。

Unity DLL在加载ARM64时找不到

英文:

In my unity project I have 2 versions of my custom DLL, one for x86 and the other for ARM64 (for unity editor and target device respectively)

The x86 dll works as intended, however when deploying to my ARM64 device (Hololens 2) I get the following error:

DllNotFoundException: Unable to load DLL 'OpenCV_ImageProcessing_ARM64'. Tried the load the following dynamic libraries: Unable to load dynamic library 'OpenCV_ImageProcessing_ARM64' because of 'Failed to open the requested dynamic library (0x06000000) - The specified module could not be found. (WinError:0000007e)
at InspectionMenu.processCrack (UnityEngine.Color32[]& raw, System.Int32 width, System.Int32 height) [0x00000] in <00000000000000000000000000000000>:0
at InspectionMenu.Update () [0x00000] in <00000000000000000000000000000000>:0

The DLLs are imported depending on which system is running, this works as intended.

    #if UNITY_EDITOR
        [DllImport("CrackDetection")]
        public static extern void processCrack(ref Color32[] raw, int width, int height);
    #else
        [DllImport("OpenCV_ImageProcessing_ARM64")]
        public static extern void processCrack(ref Color32[] raw, int width, int height);
    #endif

I have both DLLs located in the Assets/Plugins folder and the names are correct. I've looked into the possibility of other dependencies of the DLLs not being found via Dependencies and added the ARM64 OpenCV DLLs located in the picture below to the same Assets/Plugins folder but still no luck. I'm not sure if I also need to add MSVCP140.dll and VCRUNTIME140.dll but I'm not sure where I would find those.

Unity DLL在加载ARM64时找不到

答案1

得分: 0

已找到问题,必须将MSVCP140.dllVCRUNTIME140.dll添加到插件文件夹中,以及CONCRT140.dll。这些文件都可以在Visual Studio中找到。

英文:

Figured out the issue, MSVCP140.dll and VCRUNTIME140.dll had to be added to the plugins folder, as well as CONCRT140.dll. These are all files that can be found in visual studio

huangapple
  • 本文由 发表于 2023年8月4日 02:50:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76830897.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定