[fpc-pascal] Class constructor called unconditionally

Michael Van Canneyt michael at freepascal.org
Thu Mar 31 18:08:24 CEST 2016

On Thu, 31 Mar 2016, Dmitry Boyarintsev wrote:

> On Thu, Mar 31, 2016 at 11:28 AM, Graeme Geldenhuys <
> mailinglists at geldenhuys.co.uk> wrote:
>> On 2016-03-31 16:06, Michael Van Canneyt wrote:
>>> I usually have a 'Start Application' kind of routine where I register all
>>> the necessary things, link things together (needed if you follow 'loosely
>>> coupled' design).
>> I do the same. The tiOPF project follows a similar path in the core
>> framework and its UnitTest suite. It works well.
> One could use an alternative approach and have "binding" units.
> The unit would consist of initialization section only, that does the
> necessary binding code.
> They allow to avoid code within "start application" routine across
> different projects.
> At the same time they keep the actual library units free of initialization.

I have 1 common  routine which is called from all my projects. It accepts an
enumeration to decide what parts to start.

I guess this is your 'binding' unit idea, except it doesn't have an
initialization section...


More information about the fpc-pascal mailing list