方法可以在dll中返回一个链表,大致如下:
type
TInfo = record
id: string;
name: string;
sex: string;
end;
var
MyInfo: ^TInfo;
MyList: TList;
i: Integer;
B, Y: Integer;
begin
MyList := TList.Create;
//存入方法
try
begin
for i := 0 to 5 do
begin
New(MyInfo);
MyInfo^.id := 'id' + IntToStr(i);
MyInfo^.name := 'name' + IntToStr(i);
if i Mod 2 = 0 then
MyInfo^.sex := '男'
else
MyInfo^.sex := '女';
MyList.Add(MyInfo );
end;
//取出方法
Y := 10;
for B := 0 to (MyList.Count - 1) do
begin
MyInfo := MyList.Items;
Canvas.TextOut(10, Y, MyInfo^.id);
Inc(Y, 30);
Canvas.TextOut(10, Y, MyInfo^.name);
Inc(Y, 30);
Canvas.TextOut(10, Y, MyInfo^.name);
Inc(Y, 30);
end;
//内存释放
for B := 0 to (MyList.Count - 1) do
begin
MyInfo := MyList.Items;
Dispose(MyInfo);
end;
end;
finally
MyList.Free;
end;