[fpc-devel] initialization order of units

Florian Klämpfl florian at freepascal.org
Thu Oct 22 23:24:41 CEST 2020

Am 22.10.20 um 23:04 schrieb Pascal Riekenberg via fpc-devel:
>> Jonas Maebe via fpc-devel <fpc-devel at lists.freepascal.org> hat am 22.10.2020 22:28 geschrieben:
>> On 22/10/2020 21:35, Pascal Riekenberg via fpc-devel wrote:
>>> Have there been any changes to the initialization order of units in the
>>> last 6 month?
>>> I have a complex project with multiple units with initialization
>>> section. And now
>>> one of those units does not get initialized before it is used by the
>>> initialization part of
>>> an other unit. This worked at the beginning of the year!
>> It might be caused the fix for
>> https://bugs.freepascal.org/view.php?id=32352. Keep in mind that if
>> there are uses-cycles via the implementation section, the initialisation
>> order of the involved units is undefined.
> There it is again: my pet project: Why doesn't pascal allow circular unit references (at least for classes, like forwards)!
> I like pascal very much but this is the biggest annoyance!
> You always have to work around this (put multiple classes in one unit, create interface classes, ...). And now this:
> I have such cycles, but it worked before.
> I removed this cycles and it worked as expected.
> Isn't there a way to force the order?
> Why isn't it initialized first even if the unit is the first after Forms in the program?
> If there are uses-cycles via the implementation section why doesn't
> fpc prioritize interface order?

Basically because of this:


More information about the fpc-devel mailing list