用delphi写了一个dll,其中一个函数参数就是一个结构指针,在delphi中调用正常,可是在vc中如何调用?1、下面是dll中的声明
function fReadDomainList(pdomlist :pukeyDomainList):Integer;stdcall2、这个是delphi程序中调用
function TfrmGroup.fReadFromUkey:Boolean;
var
pukey :pukeyDomainList;
i,cnt :Integer;
s :string;
begin
Result := False;
new(pukey);
fReadDomainList(pukey);
cnt := pukey^.ItemCnt;
for i := 0 to cnt -1 do
begin
s := IntToStr(pukey^.Item[i].Domainid) +'-'+pukey^.Item[i].Domainname;
ShowMessage(s);
end;
Dispose(pukey);
Result := True;
end;不只,此函数如何在vc中调用?如何传结构指针?
function fReadDomainList(pdomlist :pukeyDomainList):Integer;stdcall2、这个是delphi程序中调用
function TfrmGroup.fReadFromUkey:Boolean;
var
pukey :pukeyDomainList;
i,cnt :Integer;
s :string;
begin
Result := False;
new(pukey);
fReadDomainList(pukey);
cnt := pukey^.ItemCnt;
for i := 0 to cnt -1 do
begin
s := IntToStr(pukey^.Item[i].Domainid) +'-'+pukey^.Item[i].Domainname;
ShowMessage(s);
end;
Dispose(pukey);
Result := True;
end;不只,此函数如何在vc中调用?如何传结构指针?
int fReadDomainList(pukeyDomainList pdomlist); stdcall;// 声明函数指针
typedef int (stdcall pfn_fReadDomainList*)(pukeyDomainList pdomlist);// 调用过程,先声明一个函数指针变量
pfn_fReadDomainList pfnRead; // 加载dll, 获取函数地址
hLib = LoadLibrary("xx.dll");
pfnRead = GetProcAddress(hLib, "fReadDomainList"); // 调用
pfnRead(....);