JNA调用的参数结构体内含二维数组及结构体内含结构体数组的解决办法

/**这是c++结构体中的数据结构

typedef struct
{
    int iRecord;
    int iRecordTime;
    int iPreRecordTime;
    int iRecorderDuration;
    int iRedundancyRec;
    int iAudioRec;
    VAG_RECORD_DAY_INFO stRecAllDay[VAG_MAX_DAYS];
    char chRecPlan[7][48];
    char szRes[256];
    int iRes[35];
    int iStreamType;
}VAG_RECORD_CONFIG_INFO, *LPVAG_RECORD_CONFIG_INFO;
 */
public class LPVAG_RECORD_CONFIG_INFO extends Structure {
    public int iRecord;
    public int iRecordTime;
    public int iPreRecordTime;
    public int iRecorderDuration;
    public int iRedundancyRec;
    public int iAudioRec;
 public VAG_RECORD_DAY_INFO[] stRecAllDay= (VAG_RECORD_DAY_INFO[])new VAG_RECORD_DAY_INFO().toArray(7);//这里要使用toArray方法来分配结构体数组,使得内存空间连续
    public byte[] chRecPlan =new byte[336];//这里要使用一维数组来表示结构体中的二维数组
    public byte[] szRes= new byte[256];
    public int[] iRes = new int[35];
    public int iStreamType;
}

猜你喜欢

转载自my.oschina.net/ffse54s/blog/1631633