Delphi XE2 Cannot get BPL plugin work -


i tried implement simple module system xe2 couldn't work. when try run under ide, can handle loadpackage() cannot class getclass() (even though registerclass()ed within initialization section of bpl). when try run under windows, "this application has failed start because rtl160.bpl not found" error, , cannot load package.

module code

type   tfrmodule = class(tframe)     button1: tbutton;     procedure button1click(sender: tobject);   private     { private declarations }   public     { public declarations }   end;  implementation  {$r *.dfm}  procedure tfrmodule.button1click(sender: tobject); begin   showmessage('hello'); end;  initialization   registerclass(tfrmodule);   showmessage('registered');  finalization   unregisterclass(tfrmodule);   showmessage('unregistered'); 

also, initialization section not being executed because see no 'registered' message box.

and host app this;

var   hmod: hmodule;   fcmod: tpersistentclass;   frmod: tframe;  procedure tform4.button1click(sender: tobject); begin   hmod := loadpackage('module.bpl');   if (hmod = 0) exit;    fcmod := getclass('tfrmodule');   if assigned(fcmod)   begin     frmod := tframe(fcmod.create);     frmod.parent := panel1;   end; end; 

host app linked runtime packages true. module doesn't have runtime packages option.

another question. saw basic example on net plan add more similar modules , what's going happen if try registerclass() second module's tfrmodule class in initialization? if need give different name each module, there's no point of modules anyway. mean, if host must know module's classes like.

everything works fine here. host app uses runtime packages vcl , rtl. module requires rtl , vcl packages. these packages have deployed. see 'registered' message box , getclass function succesfully called ...


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -