[fpc-devel] simpleipc issues
Michael Van Canneyt
michael at freepascal.org
Tue Sep 29 15:35:10 CEST 2015
On Tue, 29 Sep 2015, Juha Manninen wrote:
> On Tue, Sep 29, 2015 at 2:50 PM, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>> I am not proposing to make a new class.
>> I want a property "SingeInstance" in CustApp which activates this
> I had the very same idea when this was discussed a long time ago in
> Lazarus list.
> Martin Friebe noted that every application would then depend on this
> single-instance IPC code.
> It was a valid point. There should not be such a dependency.
For simpleIPC, yes. But the new implementation has no dependencies
except sysutils, classes. So the argument becomes void.
That's why I was glad with Ondrej's implementation.
> The right way is to use a drag-and-drop LCL component like the one
> from Luiz Américo.
That is IMHO a completely wrong implementation for 2 reasons:
1. Using a LCL component means that you must instantiate a form/datamodule first.
By that time, a database connection may already have been made (just
to name something), which is exactly what you want to avoid.
The check for single instance should be done before the first form is created.
2. Then it is only available in visually designed applications.
Services, website servers and custom console apps are non-visual.
I am specificially thinking FastCGI processes.
All these have in common that they descend from TCustomApplication.
That is why I think TCustomApplication is the only good location;
So if Ondrej does not do it, I will add it myself anyway.
Lazarus is free not to use it, obviously.
More information about the fpc-devel