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

Martin Friebe lazarus at mfriebe.de
Sun Jun 21 20:39:17 CEST 2009



Graeme Geldenhuys wrote:
> Martin Friebe wrote:
>>
>> Example: I may write a cgi-application (therefore it must have the 
>> web-fcl CgiApplication, right?), but I want to use this app to report 
>> the current screen resolution on the Server, so I do want to access 
>> the Screen object from the forms unit,
>
> As a side note:
> CGI applications are actually non-GUI applications. Which also means 
> they can run on for example a Linux server that doesn't have a GUI 
> running or even installed. So including Forms unit or any GUI units 
> for that matter is going to causes that CGI application to fail or 
> report errors on startup anyway because they cannot find the DISPLAY 
> environment variable or open a connection to the running X11 server. I 
> have first hand experience with this and had to rework the core tiOPF 
> framework units to be truly non-gui, at which point my CGI apps and 
> console based unit test suite started working correctly.
>
> Windows users never detect this problem, because you don't get Windows 
> severs without a GUI (though I believe Microsoft is working on such a 
> Server release now).

True, but not the point, sorry.

The point I was trying to make, is that a developer may, for whatever 
reason, under whatever conditions and assumptions *intentionally* add 
more than one unit wich creates an application. And this developer may 
access all of those created applications for different scenarios.
This may not be common, this may be rare indeed, but possible.

So the question I was raising was: Is forcefully avoiding any multi-app 
scenario the right solution?

The problem was started due to being forced to use a unit, that the 
developer didn't want. IMHO this must be solved, the rest is 
responsibility of the developer.

Best Regards
Martin







More information about the Lazarus mailing list