如果传递结构体,vc的要和c#的结构体对应起来,
在函数中vc要用void*接受结构体, c#使用IntPtr 类型
c#中通过下面的方式,从结构体转化为 intptr
int nlen = Marshal.SizeOf(typeof(stlog));
IntPtr ptr = Marshal.AllocHGlobal(nlen);
Marshal.StructureToPtr(a, ptr, false);
add_monitor_info(ptr,nmsglevel,1);
Marshal.FreeHGlobal(ptr);
///
注意:
结构体中 char [] 数组的设置要与c#中进行一下的设置配对
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 200)] //200为vc中数值的长度
public string szInfo;
vc中结构体要已1字节对齐,