Registriert seit: 13. Jan 2004
Ort: Hamm(Westf)
1.926 Beiträge
Delphi 12 Athens
|
Re: DLL wegen RTTI zu einem Package umbauen
28. Aug 2006, 16:29
Danke an alle
Diese Beispiel scheint zu funktionieren
nochmals Danke!
Das Package
Delphi-Quellcode:
package Test;
{$R *.res}
{$ALIGN 8}
{$ASSERTIONS OFF}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS ON}
{$RANGECHECKS ON}
{$REFERENCEINFO OFF}
{$SAFEDIVIDE OFF}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST ON}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$IMPLICITBUILD OFF}
requires
vcl,
rtl;
contains
TESTLIB in ' TESTLIB.pas';
end.
Unit des Packages
Delphi-Quellcode:
unit TESTLIB;
interface
uses dialogs;
Procedure LoadLib;
exports LoadLib;
implementation
Procedure LoadLib;
Begin
Showmessage(' *Schnips*');
end;
end.
Die Anwendung
Delphi-Quellcode:
unit Testformular;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
TTestProc = Procedure;
var
Form1: TForm1;
Alib:Thandle;
aMethod:TTestProc;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var p:Pointer;
begin
alib := 0;
alib := LoadPackage(Pchar(' Test.bpl'));
If alib<>0 then
Begin
p := nil;
p := GetProcAddress(alib,PChar(' LoadLib'));
if p <> nil then
Begin
@AMethod := p;
AMethod;
end;
UnloadPackage(alib);
end;
end;
end.
Andreas Monads? Wtf are Monads?
|
|
Zitat
|