欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

DLL的静态调用

程序员文章站 2022-06-24 21:56:45
...
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    btn1: TButton;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;



var
  Form1: TForm1;

implementation

{$R *.dfm}
                                                                                         //DLL的静态调用
Function MyMax ( X , Y : integer ) : integer ; stdcall ; external 'Project1.dll' ;       //第一步:声明函数

procedure TForm1.btn1Click(Sender: TObject);
begin
  ShowMessage ( IntToStr(MyMax(30,50)) ) ;                                               //第二步:调用声明函数
end;

end.