[fpc-devel]Re [2]: Some more compiler problems
Peter Vreman
peter at freepascal.org
Mon Apr 2 16:59:40 CEST 2001
>
> >> Problem N1. It is a dependency problems. I have some 50-60 units
> >> that are in various ways interconnected (although, without
> >> crosslinks). The main problem is that the main unit initializes
> >> after some other second-level units.
> > ?? And this was not true in earlier versions ?
> > I don't think anything has changed in this area of the compiler ?
> > Michael.
>
> Seems to be it was in earlier versions too... But anyways I cannot see
> what I'm doing wrong (this bug appeared some days ago when I've did
> several changes to programs I compile). Btw, what's the algo of finding
> the most main unit that must be initialized first? Maybe there are some
> logic problems?
>
> At least compiler could give an error if it cannot decide which unit
> to initialize first... It gives such error if units declare usage
> of each other in the interface part. But it says nothing if units
> declare usage in the implementation part (this is a correct behaviour
> I suppose, but then why it doesn't works correctly?).
1. Used units in the interface are loaded
2. Interface parsed
3. Used units from implementation loaded
4. Implementation parsed
The order in which the initialization is written is the order of loading of the units.
This is hard to guess in a generic way when the project contains interdependent units.
The only thing how you can control is by placing the unit that must be initialized before
the current unit in the interface uses line.
More information about the fpc-devel
mailing list