分类:
2007-04-21 15:19:57
procedure TForm1.Button1Click(Sender: TObject);
var
D: Double;
DLLHandle: THandle;
Func: TGetDouble;
begin
DLLHandle := LoadLibrary('DLLOne.dll');
try
@Func := GetProcAddress(DLLHandle, 'GetDouble');
if Assigned(@Func) then
begin
D := Func(2.2);
Edit2.Text := FloatToStr(D);
end;
finally
FreeLibrary(DLLHandle);
end;
end;
end.
隐式调用:
library DLLOne;
uses
SysUtils,
Classes;
{$R *.res}
function GetDoubleExt(F:Double): Double;stdcall;external 'DLLTwo.dll';
function GetInt(I:Integer): Integer;stdcall;external 'DLLTwo.dll';
function GetInteger(I:Integer): Integer;stdcall;
begin
Result := GetInt(I);
end;
function GetDouble(D:Double): Double;stdcall;
begin
Result := GetDoubleExt(D);
end;
exports
GetInteger,
GetDouble;
begin
end.