请熟悉delphi指针和vc dll的高手帮忙,如果嫌分少,愿意倾其家产。(20分)

  • 主题发起人 sunjguang
  • 开始时间
S

sunjguang

Unregistered / Unconfirmed
GUEST, unregistred user!
我调用vc的dll,函数为:function Readxx(CertLen:pInteger;Cert:string):integer;s
tdcall;external'SSK.DLL' name 'Readxx';

调用过程为:
var
ptr : pinteger;
Rootl:string;
begin
RootLen:=0;//私有变量
setlength(Rootl,1000);
ptr:=@RootLen;
ret:=Readxx(ptr,Rootl);
end;

调用的时候老是有异常出现,说指针无效,我刚学delphi大家给看看是哪个地方不对.
 
vc的dll中不可能有string类型的参数吧?是pchar吧?
 
错误信息是什么?是什么指针出错啊?
调用VC的DLL最好不要用string。用PChar.
 
ptr:=@RootLen[1]
 
Delphi和VC交换字符串的话因该用PChar
 
顶部