c# - 使用 aruco V3 时,DLL 导入失败,ESP 未在函数调用中正确保存

标签 c# opencv dll dllimport aruco

我正在尝试将 ArUco V3 集成到 Unity 项目中。

因此我创建了一个 .DLL,它作为函数导入,如下所示:

private static extern void functionName(uint, uint, float, float,float,float,IntPr,float)

头文件中的函数是:

void functionName(unsigned int, unsigned int, float, float, float, float, float const*, float)

我用这个方法调用它:

aruco::Markerdetector 
aruco::Cameraparameters(CalculateCameraMatrix(float, float, float, float), CalculateDistortionCoefficients(float const*), cvSize(uint, uint))

运行应用程序时,opencv.core 和 opencvimgproc DLL 会不断加载和卸载。

这是参数转换的问题还是与编译 OpenCV 期间使用的调用约定有相关性。

最佳答案

可以通过为每个dll导入方法单独添加调用约定来解决问题

 [DllImport("Name", EntryPoint = "EntrypointName", CallingConvention =CallingConvention.Cdecl)]

关于c# - 使用 aruco V3 时,DLL 导入失败,ESP 未在函数调用中正确保存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59787242/

相关文章:

c# - 从 WebSocketCollection 获取特定客户端

c# - webclient 方法不适用于我的 Silverlight 应用程序

python - 无法解压不可迭代的 numpy.float64 对象 python3 opencv

c++ - 放置在外部 DLL 中的类中 wstring 数据的内存损坏

c++ - 如何处理 "This application has failed to start because myproject.dll was not found."错误

c# - 字段列表中的 EF4 未知列

C# 新手 : how to know the meaning of a variable in a lambda expression

python - 在找到的边界python opencv中提取内容?

macos - OpenCV - 地球移动器的距离问题,ic​​vInitEMD()

c++ - 如何将 dll 位置更改为 Codelite 中的子目录?