我调用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大家给看看是哪个地方不对.
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大家给看看是哪个地方不对.
unsigned char
对应pascal是: Byte,而是stringfunction Readxx(cLen: PInteger; Cert: PByte): Integer; stdcall;但指针是一样的,所以可以写成:
function Readxx(cLen: PInteger; Cert: PChar): Integer; stdcall;
or
function Readxx(cLen: PChar; Cert: PChar): Integer; stdcall;
or
function Readxx(cLen, Cert: PChar): Integer; stdcall;
or
function Readxx(cLen, Cert: Pointer): Integer; stdcall;但用的时候,要转成对应的,如PInteger, PByte, PChar之类就行了。
@S[1]
而不是@S
因为S仅保存的是指向一个内存块的指针,而指向的内存块中存储的才是串的内容。
[email protected]