0

请帮助我使用 c# 中的 DLLImpot。我有 DLL,用 DLL Export Viewer 分析,这个类方法如图:

public: static float * __cdecl Evaluator::calculateLM(float *,float *,int,int,float *,float *)

我只是不知道如何将DllImport其转换为 c#。

4

1 回答 1

0

终于想通了。

[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);
于 2013-01-31T11:03:41.677 回答