function ReturnCall(P:PChar):Boolean;stdcall;external 'trade.dll ';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
P:PChar;
begin
try
P:=StrAlloc(1024);
if ReturnCall(P) then
ShowMessage(string(P));
finally
StrDispose(P);
end;
end;
dll的如下:
uses
SysUtils,
Classes;
function ReturnCall(P:PChar):Boolean;stdcall;
begin
StrCopy(P, 'this is a demo! ');
Result:=True;
end;
exports
ReturnCall;
{$R *.res}
begin
end.
dll传参
最新推荐文章于 2021-05-08 00:01:10 发布