[Lazarus] global items in TApplication

Marc Santhoff M.Santhoff at web.de
Sun Sep 15 05:22:12 CEST 2013


Hi,

in the process of restructuring an old application I'm stuck on the
question where to put globals. For example a global configuration object
that has to be available in many units.

The problem ist:

- I cannot include the main program file (.lpr) in the "uses" clause,
which means simple variables are not accessible.

- I cannot derive my own TApplication descendant because there is some
magic behind the scenes working on TApplication directly (IIRC a
constructor in the initialization part of forms.pp). This I'd like best,
all globals (vars and references to objects) would be aggregated inside
the application object.

In the past those globals where put as global vars inside the declaring
unit and created in the initialization part, e.g. a TConfig is declared
in unit config.pp and created on program start in config.pp, too.

The goal now is to have all global in the .dpr file of the program.

How do you handle this?
How can I meet the spec and put all global into the .dpr-file?

TIA,
Marc

-- 
Marc Santhoff <M.Santhoff at web.de>





More information about the Lazarus mailing list