结构体定义:
typedef struct{
int a1;
int a2;
int* array; //指向数组的指针
}struct1, *Pstruct1;vc中的函数体:
extern "C" _declspec(dllexport) int Test2(Pstruct1 struct1)
{
................
int array[10]; for(int ii = 0; ii < 10; ii++)
array[ii] = ii;
struct1->array = array; ////指向数组的指针赋值
..................................
}
请问:在delphi中相应的结构体怎么定义呢?并且怎么访问指针里面的数据
typedef struct{
int a1;
int a2;
int* array; //指向数组的指针
}struct1, *Pstruct1;vc中的函数体:
extern "C" _declspec(dllexport) int Test2(Pstruct1 struct1)
{
................
int array[10]; for(int ii = 0; ii < 10; ii++)
array[ii] = ii;
struct1->array = array; ////指向数组的指针赋值
..................................
}
请问:在delphi中相应的结构体怎么定义呢?并且怎么访问指针里面的数据
在type下面:
TStruct1 = record
a1:Integer;
a2:Integer;
A:Array of Integer;
end;
主程序直接调用text2,把这个结构体的指针传进去就可以了。
al:integer;
a2:integer;
arr:array of integer;
end;// 我觉得你最好再加一个参数 表示这个arr的长度...
访问 一样的呀..Test a;
// 对其赋值...
a.arr[0].....