一个例子:
/////DLL
library Project1;
uses
; SysUtils, Classes,
; Unit1 in 'Unit1.pas';
{$R *.RES}
; exports Open;
begin
end.
//////////// Unit1
unit Unit1;
interface
; uses forms;
; procedure Open(var form :Tform);
implementation
; procedure Open(var form :Tform);
; begin
; ; form .Caption := 'abc';
; end;
end.
/////////////////
program Project2; 用它来调用dll
uses
; Forms,
; Unit2 in 'Unit2.pas' {Form2};
{$R *.RES}
begin
; Application.Initialize;
; Application.CreateForm(TForm2, Form2);
; Application.Run;
end.
//////////////////
unit Unit2;
interface
uses
; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
; StdCtrls;
type
; TForm2 = class(TForm)
; ; Button1: TButton;
; ; procedure Button1Click(Sender: TObject);
; private
; ; { Private declarations }
; public
; ; { Public declarations }
; end;
var
; Form2: TForm2;
; procedure Open(var form :Tform);external 'Project1' ;
; implementation
{$R *.DFM}
procedure TForm2.Button1Click(Sender: TObject);
var
; form :TForm ;
begin
;form := Form2 as Tform;
;open(form);
end;
end.
//// 调试通过的!别忘给分啊