[fpc-devel] CGI/Command line/GUI all in one

Joost van der Sluis joost at cnoc.nl
Thu Sep 17 13:35:33 CEST 2009


On Thu, 2009-09-17 at 11:50 +0200, Gilles MARCOU wrote:
> Hello,
> 
> I'm trying to build an interface for a program so that it could be used
> as a command line, a GUI or a CGI. For the CGI, I use powutils 1.7.1,
> FPC 2.2.0 and Lazarus 0.9.24. I mean that the same executable should be
> used either as a CGI, a command line or a GUI.
> 
> Currently I have kept separated in different unit each user interface
> (see the code below). But, at execution, if there is an execution error,
> it always open message box. Therefore, even in command line, the
> software requires GUI libraries be there (GTK for instance) and it
> simply does not work as a CGI.

If you really have a console-only program, you shoudn't use any
lcl-units (that pulls in the forms unit) in your program. That'll solve
the problem.

> Do you see a more clever solution? Otherwise, the only solution I see is
> to keep all three interfaces in separate executable.

Or you can select the 'nogui' widgetset in Lazarus. That'll also solve
your problem.

Joost




More information about the fpc-devel mailing list