Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any ideas for Delphi XE can randomly not load design package?

I've created a design package with component registration (component itself is in run-time) and some IDE menu items.

If I click on "Install" menu item in context menu from Project manager - package will be loadeded and works normally (always).

If I close IDE and restart it - package may be loaded or may not be loaded. Seeming randomly. But it's usually doesn't load, than load.

If I go to Component/Install packages - I see my package in the list, checkbox is checked, "Components" button shows components in my package, but package's executable itself is not even loaded in IDE! (I've verified this via Process Explorer). Reinstalling (remove package -> Ok -> Component/Install packages -> Add -> Ok) doesn't help. But uninstalling/installing from context menu of the project in Project manager - always helps.

I've added OutputDebugString into initialization section of each my module in the package. And I've found that initialization sections just doesn't run.

Run-time package is in the same folder as design-time package. Folder is in the PATH environment variable. I also tried to place packages in Delphi's Bin folder. No error messages. No strange/diagnostic OutputDebugStrings.

Any ideas?

P.S. I have this behaviour on 2 different machines. One is Win7, another is WinXP SP 2.

P.P.S. I wasn't able to reproduce this behaviour on Delphi 7. Same package, recompiled for D7 loads always.

like image 911
Alex Avatar asked Oct 20 '10 11:10

Alex


1 Answers

I've found that new Delphi have feature of delayed package loading. This should optimize startup speed, when packages aren't loaded, when they are not needed.

This works fine for component packages, but spoils a fun for packages which (for example) modifies IDE menu.

You can tell IDE to always load your package by calling ForceDemandLoadState(dlDisable) from Register procedure.

P.S. Why do you always find answer by yourself almost immediately after posting a question? :D

like image 192
Alex Avatar answered Nov 14 '22 23:11

Alex