Am 28.11.2017 20:04 schrieb "Роман via fpc-pascal" <
[email protected]>:
'Initialization' sections are executed in poorly predictable order, so I
want to partially order them according to some form of explicit
prioritization and execute before control flow enters main block (so I
won't need to run all that initialization by hand, neither I would be able
to forget to do that).
If unit A uses unit B in the interface section then unit B's initialization
section is always run before A's. For the implementation section the same
holds true if there isn't a cycle otherwise it depends on the unit load
order.
Like:
unit UnitA;
...
procedure Init;
initialization
RegisterUnit('UnitA', @Init);
end;
unit UnitB;
...
procedure Init;
initialization
RegisterUnit('UnitB', @Init, {priority} +1);
end;
...
procedure SortAndInitialize;
...
Can I run SortAndInitialize before 'main' without additional user actions?
No, you can't.
Regards,
Sven
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal