Import c++ DLL to c#
Import c++ DLL to c#
请帮助我在c#中使用DLLImpot。我有DLL,用DLL导出查看器对其进行了分析,显示了此类方法:
public: static float * __cdecl Evaluator::calculateLM(float *,float *,int,int,float *,float *)
我只是不知道如何将其DllImport
到 c# 中。
终于想通了。
[DllImport("LMModelSolve.dll",
EntryPoint = "?calculateLM@Evaluator@@SAPAMPAM0HH00@Z",
CallingConvention = CallingConvention.Cdecl)
]
static extern IntPtr calculateLM(float[] x, float[] y, int n, int iterations, float[] lower, float[] upper);
并调用并获得结果:
IntPtr res = calculateLM(x, y, ndata, 200, lower, upper);
float[] resultVertices = new float[4];
Marshal.Copy(res,resultVertices,0,4);
相关文章:
- "error: no matching function for call to"构造函数错误
- 挂起和取消挂起一个文件DLL
- 调用专用模板时出错"no matching function for call to [...]"
- std::threads可以从Windows DLL中的全局变量创建/销毁吗?
- C++ Singleton - Prevent ::instance() to variable
- 导入库可以跨dll版本工作吗
- Including dll to Visual Studio project
- 如何设置Visual Studio来调试DLL ("Unable to start program error")
- C++ dll variable to vb.net exe
- c++ dll struct to c#
- CUDA链接错误(lib to dll)
- C# DLL 导入失败:"The application has failed to start because its side-by-side configuration is incorrect
- 错误: "Unable to find the DLL xyz.dll!" Visual Studio 2010
- 使用 OpenCV 从摄像机捕获视频时"Unable to Locate DLL"
- Windows XP 上的"Unable to load DLL ... The specified procedure could not be found" C++
- C++ DLL 到 C# 错误:"Attempted to read or write protected memory. This is often an indication that other
- 为什么我会收到"Unable to find an entry point named 'SquareRoot' in DLL"消息?
- c++ to c# dll import ReadImage
- 等效于 VB DLL 函数声明的 C# 返回并返回'Attempted to read or write protected memory'错误
- Import c++ DLL to c#