我在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;
}然后在C#中调用该DLL。我是用的C#窗体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();textbox3中的可以显示99,但是textbox1中未显示100.我试了试,如果结构体中包含结构体,那么只能给第一个包含的结构体中赋值,这是为什么呢?c#dllc++struct