[Lazarus] Converting a console app

Michael Van Canneyt michael at freepascal.org
Wed Jun 30 14:18:13 CEST 2010



On Wed, 30 Jun 2010, Juha Manninen wrote:

>> There is no reason whatsoever to drag in the nogui widgetset and whatnot in
>> a  console application. That is just plain wrong. Someone using e.g. the
>> forms unit in a console application is coding wrong, and he should be
>> pointed out this fact by letting the compile step fail.
>
> Using the Forms unit would be wrong, sure, but there are Windows compatibility
> functions in eg. LCLIntf which are not only for GUI. LCLIntf is part of LCL.

In that case, these functions should be separated out in a unit that does
not use anything else (read: gui stuff) from the LCL.

>
> NoGUI widgetset is light compared to the "real" widgetsets and it should be no
> problem.

It is a problem, since you drag in a lot of stuff that should not be there
in the first place.

People using windows functions in a console application should be taught to
use proper system-independent code provided by FPC. You should not enourage a bad
writing style. In the case the point is to just compile a windows application using
FPC, you might as well leave the windows unit in the uses clause and be done
with it.

>
> Am I right?

IMHO: Definitely not. You hide what is in my opinion a programming error:
using a Windows API in so-called portable code. On top of that, you drag in
totally unneeded code which serves in essence only to make the linker happy. 
I'm surprised anyone thought of the nogui widget set to start with ! :/

Michael.




More information about the Lazarus mailing list