C#调用C++DLL的问题
我在C++dll中定义了这样两个结构体。并提供一个接口
struct score
{
double chinese;
double english;
double math;
double together[3];
};
struct info
{
score scc;
score scc1;
double hehe[100];
};
DATAINTERFACEDLL_API __int32 setNum(info* aaa)
{
aaa->scc1.chinese=100;
aaa->scc.chinese=99;
return 0;
}
public struct score
{
public double chinese;
public double english;
public double math;
public double[] together;
};
public struct info
{
public score scc;
public score scc1;
public double[] hehe;
};
////////
[DllImport("……\\DataInterfaceDll.dll", EntryPoint = "setNum")]
public static extern int setNum(ref info aaa);
////
public Form1()
{
InitializeComponent();
info inf=new info();
SMotionInfoToShow smits = new SMotionInfoToShow();
setNum(ref inf);
setInfo(ref smits);
textBox1.Text = inf.scc1.chinese.ToString();
textBox3.Text = inf.scc.chinese.ToString();