导航:
论坛 -> DELPHI技术
斑竹:liumazi,sephil
作者:
2003/8/3 11:50:19
标题:
加入我的收藏
楼主:
例如: function info_str(card_num:string):string;stdcall; begin result:=card_num; end; exports info_str; 请较这个函数生成dll文件再调用时出错,提示是:invalid pointer operation 为什么? 请指较啊 谢。。。 但函数改成: function info_str(card_num:integer):integer;stdcall; begin result:=card_num; end; exports info_str; 就没有错误。
----------------------------------------------
http://www.jiesky.com 共同学习,共同努力!
作者:
bios (阿贡)
★☆☆☆☆
-
盒子中级会员
2003/8/3 15:02:44
1楼:
function strret(st:string):string;external 'guai1.dll'; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin try edit1.Text :=strret('haha'); except on EInvalidPointer do begin exit; end; end; end; //********************************************************************* function strret(st:string):string; var p:PString; l:Longint; begin p:=@Result[1]; if st<>' then l:=Length(st) else l:=0; try GetMem(p,l); p^:=st; Result:=p^; finally freemem(p); end; end;
----------------------------------------------