[fpc-devel]Re : Some more compiler problems
jonas at zeus.rug.ac.be
Mon Apr 2 16:55:54 CEST 2001
On Mon, 2 Apr 2001, Aleksey V. Vaneev wrote:
> 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?
The order of unit initialization is simply the order in which they are
declared in your program. If you use a unit X within another unit Y, that
that unit X will be initialized before unit Y. All units will be
initialized only once.
> At least compiler could give an error if it cannot decide which unit
> to initialize first...
This never happens, since the order is simply read from the source. If you
compile your program with -a, you can see the order in which the units are
initialized by looking at the generated .s file for the main program and
by then searching for "INITFINALTABLE".
More information about the fpc-devel