C++封装函数,输入参数 int a,double b,float ,返回值是float
C+代码
extern "C" __declspec(dllexport) float Add(int a,double b,float c) { return a + b + c; }
C+代码
[DllImport("ConsoleApplication1.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] public static extern float Add(int a ,double b,float c); //调用 float d = Add(1, 2.5, 3.3f); MessageBox.Show($"Result: {d}");

浙公网安备 33010602011771号