日期:2014-05-17 浏览次数:20802 次
struct CalcParm
{
double m_dRlu;
double m_dConc;
};
extern "C" _declspec(dllexport) int TestFunc(CalcParm* arr)
{
CalcParm aa;
aa.m_dConc= 333;
aa.m_dRlu =5555;
arr[0]= aa;
return 10;
}
extern "C" _declspec(dllexport) int TestFunc2(int* arr)
{
arr[0]=10;
return 10;
}
[DllImport("CalcHelper.dll")]
public extern static int TestFunc1(ref CalibrationStandardPoint arr);
[DllImport("CalcHelper.dll")]
public extern static int TestFunc2(ref int arr);
//声明结构体
/// <summary>
/// 发光值-浓度值结构体
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public class CalcParm
{
public double m_dRluValue; //发光值
public double m_dConcentration; //浓度
};
//测试调用
int[] arr =new int[3];
TestFunc2(ref arr[0]);
//↑该方法测试通过,并且修改成功
CalcParm[] arr2 =new CalcParm[3];
TestFunc2(ref arr2);//运行结束后报错