大家好
小弟在幫一個POS_DATA_2D_F64 結構進行記憶體配置出了點錯誤
[StructLayout(LayoutKind.Sequential)]
public struct POS_DATA_2D_F64
{ public UInt32 u32_opt;
public Double f64_x;
public Double f64_y;
public Double f64_theta;
}
UInt32 cnt = 5;
POS_DATA_2D_F64* a;
IntPtr ap = Marshal.AllocHGlobal(sizeof(POS_DATA_2D_F64) * cnt);
a = (POS_DATA_2D_F64*)ap;
===
Error 4 Argument '1': cannot convert from 'long' to System.IntPtr
cnt 如果不用Uint32就會過
但是cnt 必須是Uint32
請問此部分要怎麼改
感謝各位~~~