现在的位置: 首页 > 综合 > 正文

使用动态包导出函数的单元的完整源代码

2013年07月01日 ⁄ 综合 ⁄ 共 774字 ⁄ 字号 评论关闭

unit FunkFrm;

interface

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

type
  TFunkForm = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
//Declare the package functions using the StdCall calling convention
procedure FunkForm; stdcall;
function AddEm(Op1, Op2 : Integer) : Integer; stdcall;

//Export the functions
exports
  FunkForm,
  AddEm;

implementation

{$R *.dfm}
procedure FunkForm;
var
  FunkForm : TFunkForm;
begin
  FunkForm := TFunkForm.Create(Application);
  try
    FunkForm.ShowModal;
  finally
    FunkForm.Free;
  end;  
end;

function AddEm(Op1, Op2 : Integer) : Integer;
begin
  Result := Op1 + Op2;
end; 
procedure TFunkForm.Button1Click(Sender: TObject);
begin
  ShowMessage('你已经正确地调用了包的导出函数。');
end;

end.

抱歉!评论已关闭.