unit Unit_main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ExtCtrls;
type
THallo =
procedure;
TForm1 =
class(TForm)
Panel1: TPanel;
SpeedButton1: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
packagemodule:hmodule;
Hallo:THallo;
procedure PackageLoad;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure tform1.PackageLoad;
begin
PackageModule := LoadPackage('
package1.bpl');
if packagemodule<>0
then
try
@Hallo:=GetProcAddress(PackageModule,'
Hallo');
except
ShowMessage('
Package not found');
end;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
if packagemodule=0
then packageload;
//if assigned(Hallo) then Hallo(1); [i]//No parameters expected... ???[/i]
if assigned(Hallo)
then Hallo;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if packagemodule<>0
then
unloadpackage(packagemodule);
end;
end.