C#: marshalling a struct that contains arrays

前端 未结 3 1847
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 21:25

I am doing some C# interop work. I have the following struct:

#pragma pack(push,1)
typedef struct
{
    unsigned __int64 Handle;
    LinkType_t Type;
    Lin         


        
3条回答
  •  轮回少年
    2021-01-02 21:29

    For the arrays, try to use the fixed keyword:

    public fixed byte DeviceInfo[MAX_LINK_DEVINFO];
    public fixed byte Reserved[40];
    

提交回复
热议问题