[DUG] Usage - initialization and finalization

Kyley Harris kyley at harrissoftware.com
Mon May 22 16:12:25 NZST 2006


There is no such thing as a circular reference in Delphi. IE. The
compiler will come up with a compiler error. 

What you are referring to is where one unit references another in this
fashion.

Unit UnitA

Interface
  Uses UnitB

Unit UnitB

Implementation
Uses
  UnitA;


Initialization and finalization are part of the private implementation
of a unit. Not a public part of a unit. No code in unitA interface has
any relevance to an initialization, because there is no executing
code.....
UnitB is clearly saying that its executing portion requires information
from UnitA. Initializations must execute in dependency order.

So. What do you think the order will be?

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Karl @ Work
Sent: Monday, 22 May 2006 10:36 a.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Usage - initialization and finalization

> Finalization is determinate, otherwise your program would blow-up.
> As I just mentioned in my last email. Initializations and 
> finalizations
> are dependency based. 

And what exactly is the rule of order when circular unit references
exist?

Cheers,
Carl



More information about the Delphi mailing list