[Lazarus] Some thoughts about the global 'Application' instance.

Michael Van Canneyt michael at freepascal.org
Thu Jun 18 16:40:39 CEST 2009



On Thu, 18 Jun 2009, Joost van der Sluis wrote:

> Hi all,
>
> I always thought that an application always had one Application-instance
> from the TCustomAppliction class. But at this moment this is not the
> case for fcl-web applications, or daemon-applications which are using
> Lazarus-forms.
>
> Take for example the fpcgi unit from fcl-web. (not the old one from
> Lazarus) There a global variable Application is defined and initialized
> and finalized. This Application should be used throughout the program.
>
> But nowadays we are forced to include the 'interfaces' unit, which uses
> the 'forms' unit which has it's own global Application variable. So
> there are two TCustomApplication descdendents initialized during the
> program!
>
> Now in daemonapp.pp to avoid this kind of problems with several
> different kinds of daemon-applications (the one with lazarus and
> without) it is done somewhat different. The function Application is
> defined as a singleton and which kind of application is created depends
> on a variable which has to be set by units implementing descendents of
> TDaemonApp.
>
> Can we move this functionality to the CustApp unit? That way you can
> always refer to custapp.Application and you have the 'current'
> application instance.

I see no problem with that.

Michael.




More information about the Lazarus mailing list