[fpc-pascal] Options -WG -WC -WF -WT

Sven Barth pascaldragon at googlemail.com
Sun Jan 29 20:13:36 CET 2012


On 29.01.2012 18:31, Mattias Gaertner wrote:
> On Sun, 29 Jan 2012 18:03:56 +0100
> Sven Barth<pascaldragon at googlemail.com>  wrote:
>
>> On 29.01.2012 17:04, Mattias Gaertner wrote:
>>> Hi,
>>>
>>> According to fpc -h (2.7.1):
>>>
>>> Option -WG creates graphic type application (EMX, OS/2, Windows).
>>> Option -WC creates console type application (EMX, OS/2, Windows).
>>>
>>> fpc -h (2.6.1) knows also:
>>> Option -WF creates full screen type application (EMX, OS/2)
>>>
>>> And the "user" documentation knows one more:
>>> http://www.freepascal.org/docs-html/user/usersu15.html#x38-450005.1.4
>>>
>>> -WT Generate a TOOL application (+) or a console application (-).
>>>
>>> Are these correct or maybe outdated?
>>
>> Here is the complete list of supported apptypes:
>>
>> -WA = {$apptype native}: currently only used for NativeNT target if a
>> driver is compiled (not finalized yet, so I wouldn't build on that ;) )
>> -WC = {$apptype console}: Console application on EMX, OS/2 and Windows
>> (and according to compiler source also classic Mac OS). On Windows this
>> means that calling that application from inside e.g. cmd.exe will block
>> cmd.exe until the application is finished. Calling the application using
>> the explorer will result in a console window appearing.
>> -WG = {$apptype gui}: GUI application on EMX, OS/2 and Windows (and
>> according to compiler source also classic Mac OS).
>> On Windows this means that e.g. cmd.exe won't block when such an application is started and on
>> console window will be shown. Also the Std I/O is closed by the application
>> -WF = {$apptype fs}: Fullscreen application on EMX and OS/2
>
> For 2.7.1 too?
> The option is missing in the ppcx64 -h help.

I took this knowledge from the compiler's source directly, so yes.

>>> What kind of program is created under Windows without any of
>>> these options?
>>
>> The apptype always (not only Windows) defaults to "Console" except on
>> WinCE where the default is "GUI".
>>
>> Note (as I've also read your other mail): I would not suggest to let the
>> IDE automatically set this based on some obscure logic. The option in
>> "Project Settings =>  Compiler Settings =>  Linking =>  Target specific
>> options" is enough.
>
> The "obscure logic" prevents that -WG is passed to the compiler for
> invalid targets. Otherwise the compiler stops with an error.

I'm not talking about that specific "obscure logic". I just wanted to 
avoid that you add "more strange obscure logic" ;P

> If I understand correct, then a Windows application without -WG is
> compiled as a console application and a writeln/readln should work.
> Right?

This is correct. At least on Win32 and Win64.

Regards,
Sven



More information about the fpc-pascal mailing list