Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-03

Suppressing the console window in Win32

11 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Steve Williams

I'm building a graphical application using GameVision (http://www.jarroddavis.com/). The application compiled in FPC opens a console window whenever the application is executed. The application compiled in Delphi does not open a console window. How do I not have the console window automatically opened when the application is compiled with FPC?

Sly

Peter Vreman
to Steve Williams
Show quoted text 6 lines
I'm building a graphical application using GameVision (http://www.jarroddavis.com/). The application compiled in FPC opens a console window whenever the application is executed. The application compiled in Delphi does not open a console window. How do I not have the console window automatically opened when the application is compiled with FPC?

Add (delphi compatible) {$apptype gui}

Steve Williams
to Peter Vreman

Thanks. I've never had to use that in Delphi since it defaults to GUI if there is no $APPTYPE directive. Would it make sense for FPC to default to GUI if compiled in Delphi compatibility mode? I'm new to FPC so I don't know if that has been discussed before.

Incidentally, can there be a warning printed out when the $APPTYPE directive is in the wrong place and has no effect?

This works (compiles in GUI mode).

program test;
{$APPTYPE GUI}

uses
GameVision,
GVUConsole,
Globals,

  GVUInput;
{$R *.res}

This doesn't (compiles in CONSOLE mode).

program test;

uses
GameVision,
GVUConsole,
Globals,

  GVUInput;
{$R *.res}
{$APPTYPE GUI}

Sly

Earlier message 23 lines
----- Original Message ----- From: "Peter Vreman" To: Sent: Thursday, March 04, 2004 5:11 PM Subject: Re: [fpc-pascal]Suppressing the console window in Win32 > > I'm building a graphical application using GameVision > > (http://www.jarroddavis.com/). The application compiled in FPC opens a > > console window whenever the application is executed. The application > > compiled in Delphi does not open a console window. How do I not have the > > console window automatically opened when the application is compiled with > > FPC? > > Add (delphi compatible) {$apptype gui} > > > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Peter Vreman
to Steve Williams
Thanks. I've never had to use that in Delphi since it defaults to GUI if there is no $APPTYPE directive. Would it make sense for FPC to default to GUI if compiled in Delphi compatibility mode? I'm new to FPC so I don't know if that has been discussed before.

That is a Win32 (maybe also MacOSX?) only issue. On other platforms the default is to have a console.

Incidentally, can there be a warning printed out when the $APPTYPE directive is in the wrong place and has no effect?

It already gives a warning:

p.pp(4,2) Warning: Misplaced global compiler switch
Steve Williams
to Peter Vreman
> Thanks. I've never had to use that in Delphi since it defaults to GUI

if

> there is no $APPTYPE directive. Would it make sense for FPC to default

to

Show quoted text 5 lines
> GUI if compiled in Delphi compatibility mode? I'm new to FPC so I don't > know if that has been discussed before. That is a Win32 (maybe also MacOSX?) only issue. On other platforms the default is to have a console.

Delphi compatibility would only really apply to Win32, wouldn't it?

Show quoted text 7 lines
> Incidentally, can there be a warning printed out when the $APPTYPE > directive > is in the wrong place and has no effect? It already gives a warning: p.pp(4,2) Warning: Misplaced global compiler switch

Ahh. Having just got FPC 1.9.2 from SourceForge (there should be a link to that from the FPC site), it does indeed give a warning. FPC 1.0.10 does not give such a warning.

The executable also got 23KB larger just from being compiled with 1.9.2, ie. from 82KB to 105KB.

Sly

Unknown author
Show quoted text 6 lines
I'm building a graphical application using GameVision (http://www.jarroddavis.com/). The application compiled in FPC opens a console window whenever the application is executed. The application compiled in Delphi does not open a console window. How do I not have the console window automatically opened when the application is compiled with FPC?

When using gcc under win32 I use -mwindows to create a GUI app. I'm not sure if -mwindows is a gcc switch or a ld (ldw.exe in fpc) switch. If it is ld's option then adding -mwindows to the link stage should eliminate the console.

cheers,
-Krish

Peter Vreman
to Steve Williams: if to Delphi compatibility would only really apply to Win32, wouldn't it? Ahh. Having…
Show quoted text 13 lines
> > Thanks. I've never had to use that in Delphi since it defaults to GUI if > > there is no $APPTYPE directive. Would it make sense for FPC to > default to > > GUI if compiled in Delphi compatibility mode? I'm new to FPC so I > don't > > know if that has been discussed before. > > That is a Win32 (maybe also MacOSX?) only issue. On other platforms the > default is to have a console. Delphi compatibility would only really apply to Win32, wouldn't it?

For FPC delphi is a programming style not specific for win32. FPC is platform independent. That means you need to think of all platforms instead of being thightly bounded to a single platform. That is also the reason why porting delphi apps is mostly harder than it looks at first sight... they are too dependent on the WinAPI.

The executable also got 23KB larger just from being compiled with 1.9.2, ie. from 82KB to 105KB.

That is always the case... more functionality means a bigger size... for example threadvar for multithreading support takes more space. Also register calling takes more space, but it is faster.

Steve Williams
to Peter Vreman
Show quoted text 7 lines
> The executable also got 23KB larger just from being compiled with 1.9.2, > ie. > from 82KB to 105KB. That is always the case... more functionality means a bigger size... for example threadvar for multithreading support takes more space. Also register calling takes more space, but it is faster.

The project I am currently working is being compiled in Delphi 7 (at home) and FPC 1.9.2 (at work). The Delphi-compiled executable is 56KB. The FPC-compiled executable is 108KB. Not a real big issue. I'm just curious as to what makes up the large part of this difference in executable size.

Sly

Marco van de Voort
to Steve Williams
Show quoted text 12 lines
> > The executable also got 23KB larger just from being compiled with 1.9.2, > > ie. > > from 82KB to 105KB. > > That is always the case... more functionality means a bigger size... for > example threadvar for multithreading support takes more space. Also > register calling takes more space, but it is faster. The project I am currently working is being compiled in Delphi 7 (at home) and FPC 1.9.2 (at work). The Delphi-compiled executable is 56KB. The FPC-compiled executable is 108KB. Not a real big issue. I'm just curious as to what makes up the large part of this difference in executable size.

You would have to research that yourself, since the exact ratio can vary per program.

But in general FPC is written more with portability in mind, and this increases the library layer slightly. Also Delphi might have optimizations on while FPC needs params to enabled them. (I assume you already use -XXs to compile the fpc binary, you could also use -OG3p3 or so)

Steve Williams
to Marco van de Voort
But in general FPC is written more with portability in mind, and this increases the library layer slightly. Also Delphi might have optimizations on while FPC needs params to enabled them. (I assume you already use -XXs

to compile the fpc

binary, you could also use -OG3p3 or so)

I was using -Xs, but I tried -XXs -OG3p3 and it made no difference.

Don't get me wrong, FPC is still great. It gives me more warnings and hints than Delphi does, which is a good thing (I like to have a compile with no hints or warnings).

Sly

Peter Vreman
to Steve Williams
Show quoted text 9 lines
> But in general FPC is written more with portability in mind, and this > increases the library layer slightly. Also Delphi might have > optimizations > on while FPC needs params to enabled them. (I assume you already use > -XXs to compile the fpc > binary, you could also use -OG3p3 or so) I was using -Xs, but I tried -XXs -OG3p3 and it made no difference.

-XX only works with units that are compiled with smartlinking (-CX)