[lazarus] Circle dependencies in the lcl

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jan 15 13:13:33 EST 2001

Hi all,

> I think you can't avoid it.  If look at the VCL itself, how many times
> objects referred within one unit ?? In a circular reference you do
> the same. Only now for redability/maintainability/etc you split one unit
> into 2 separate units.
> If I look at the project I'm working on myself, I tried to avoid it, but
> unless I let my units grow (if you put all in one unit your problem is
> solved), I couldn't

Yes, I know the problem -sigh-.
But I think the LCL has not the 'really huge unit' problem as the VCL,
because it uses includes. Michael Hess suggested to combine the code of forms.pp
and controls.pp, and leave forms.pp a "dummy" unit. This will produce only
a slight incompatibility and a big controls.pp. Big units are terrible (see
Delphis windows.pas) but if this is the price for compatibility and
optimization then I will pay. But there are only a few cases where units must be
that big. If we would not try to be compatible to the VCL we would define a
TAbstractCustomForm for TWinControl and we could destroy the binding between
controls and forms. But I think we all agree, that this important point should
be compatible to the VCL and thus the LCL has a cross dependency between
TWinControl and TCustomForm. I will test Michael H.'s proposal and search for
more circles.

> Believe me, when I tried to create the Makefiles, I tried to first
> the Interface, after that the LCL (since the LCL is interface
> only a binary interface should satisfy). There were that many circular
> references that I gave up.

I believe you. Although I do not understand why a unit like gtkint which I
would expect to be at the bottom of the hierachy is one of the topmost.


More information about the Lazarus mailing list