unit Einbinden1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm3 =
class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
type TSummenFunktion =
function(zahl1, zahl2: integer): integer;
stdcall;
function addieren(zahl1, zahl2: integer): integer;
var SummenFunktion: TSummenFunktion;
Handle: THandle;
begin
Result := 0;
Handle := LoadLibrary(PChar(ExtractFilePath(ParamStr(0))+'
rechnen.dll'));
if Handle <> 0
then begin
@SummenFunktion := GetProcAddress(
Handle, '
addiere');
if @SummenFunktion <>
nil then begin
result:=SummenFunktion(zahl1, zahl2);
end;
FreeLibrary(
Handle);
end;
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
Label1.Caption := inttostr(addieren(15,2));
end;
end.