p/invoke 的一个有关问题 结构体内部有指针

p/invoke 的一个问题 结构体内部有指针
C++代码:
typedef struct IntChar
{
int *a;
char *b;
}SSA;
extern "C" __declspec(dllexport) void OpeStruct(IntChar *pss)
{
printf("%d\n",*(pss->a));//这里没有显示出我传入的90,显示的是一个地址,是我没有传进去吗?
printf(pss->b);//qqqq
*(pss->a)=100;
pss->b = "123456";
}

C#中:
           
           CSIntChar csic = new CSIntChar();
            IntPtr pa = Marshal.AllocHGlobal(4);
            pa = GCHandle.ToIntPtr(GCHandle.Alloc(99));
            //pa = Marshal.StringToHGlobalUni("99");
            csic.a = pa;
            csic.b = "qqqq";
            OpeStruct(ref csic);//函数调用
            Console.WriteLine(csic.a.ToString());//
            Console.WriteLine(csic.b);//
            Console.Read();
        }
        [StructLayout(LayoutKind.Sequential)]
        struct CSIntChar
        {
            public IntPtr a;
            public string b;
        }

------解决方案--------------------
pa = GCHandle.ToIntPtr(GCHandle.Alloc(99));
Console.WriteLine(csic.a.ToString());//
你应该这样
Marshal.WriteInt32(pa, 90);
Console.WriteLine(Marshal.ReadInt32(SA.a).ToString());//

string能成功因为他是引用类型,GCHandle.ToIntPtr()分配的句柄是指向GCHandle的