Link to home
Start Free TrialLog in
Avatar of AVAHLDICK
AVAHLDICK

asked on

Runtime Package with CLX

I created a runtime package, with only an unit. This unit uses QForms. Just this !!!!!

Then I create a CLX aplication that load dinamicaly this package. When the aplication try to load, an exception raises.

What is doing here ????

Adilson Vahldcik
ASKER CERTIFIED SOLUTION
Avatar of mocarts
mocarts

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AVAHLDICK
AVAHLDICK

ASKER

EAccessViolation in RTL70.bpl. If I add this package that I created in runtime packages of the application, then it works.

But I want load dinamically, then this isn't necessary to do !?!?!?!?!?!??

I use loadpackage and unloadpackage.

Adilson
you can load dynamically, but then you must compile both (exe and bpl) with runtime package vclx70.bpl (which contains QForms).
if you add your custom package to exe's required runtime packages list, then your exe links to your custom package statically and uses QForms from that package.

if you compile with vclx70.bpl runtime package then exe (and your custom package) links to vclx70.bpl. both uses QForms from vclx70.bpl and you can load/unload your custom package at runtime whenever you want.

wbr, mo.
OK. I already added VisualCLX in both.

There is something hide. It doesnt work.

If I delete the uses QFORMS clauses in the unit from de BPL, then runs.

Try to do this that I want. I use D7.

Waiting your answers (and very very thanx for your help)

Adilson

OK. I already added VisualCLX in both.

There is something hide. It doesnt work.

If I delete the uses QFORMS clauses in the unit from de BPL, then runs.

Try to do this that I want. I use D7.

Waiting your answers (and very very thanx for your help)

Adilson

if you receive EAccessViolation error then you must check your loading and calling code (maybe post here)
or,
if you use strings as parameters (or objects that contains strings) to pass to your dynamically loadable package, then you must add to your app and package project uses ShareMem as first unit.

wbr, mo.
The package has just this unit (contains):

unit UnitofPackage;
interface
uses QForms;
implementation
end.

And requires visualclx.

The project has just a form with a button, and the source is:

procedure TForm1.Button1Click(Sender: TObject);
var
  HDLL : HModule;
begin
  HDLL := loadpackage('Package1.bpl');
  if HDLL > 0 then
  begin
    unloadpackage(HDLL);
  end;
end;

Does a matter if you mark [Build with runtime packages].

All this units and application are CLX.

Try this, please.

If I delete the third line in UnitofPackage, then runs.

Adilson
in your exe Project Options under Packages tab you must check Buld with runtime packages, delete all packages except VisualCLX. (both - package and exe must be built with same VisualCLX pacakge)

I tried exactly your code and it works (in Package requires VisualCLX and in exe Project Options - Build with runtime packages - VisualCLX)

wbr, mo.
YEEEEEEEEEEEEEEEEESSSSS

It works. Very Very Very Very Thanks Friend.

But you can see that isnt so easy, because VisualCLX isn't in the list of runtime packages !!!

Very Thanks again

Adilson