[next] [prev] [prev-tail] [tail] [up]

#### 1.3.3 $APPTYPE : Specify type of application.

This directive is currently only supported on the following targets: Win32, Mac, OS2 and AmigaOS. On other targets, the directive is ignored.

The {$APPTYPE XXX} accepts one argument which specifies what kind of application is compiled. It can have the following values:

CONSOLE
  A console application. A terminal will be created and standard input, output and standard error file descriptors will be initialized. In Windows, a terminal window will be created. This is the default.

  Note that on Mac OS such applications cannot take command line options, nor return a result code. They will run in a special terminal window, implemented as a SIOW application, see the MPW documentation for details.

  On os/2, these applications can run both full-screen and in a terminal window.

  linux applications are always console applications. The application itself can decide to close the standard files, though.

FS
  Specifies a full-screen VIO application on os/2. These applications use a special BIOS-like API to program the screen. os/2 starts these application allways in full screen.
GUI
  Specifying the {$APPTYPE GUI} directive will mark the application as a graphical application; no console window will be opened when the application is run. No standard file descriptors will be initialized, using them (with e.g. writeln statements) will produce a run-time error. If run from the command line, the command prompt will be returned immediatly after the application was started.

  On os/2 and Mac OS, the GUI application type creates a GUI application, as on Windows. On os/2, this is a real Presentation Manager application.

TOOL
  This is a special directive for the Mac OS. It tells the compiler to create a tool application: It initializes Input, Output and StdErr files, it can take parameters and return a result code. It is implemented as an MPW tool which can only be run by MPW or ToolServer.

Care should be taken when compiling GUI applications; the Input and Output files are not available in a GUI application, and attempting to read from or write to them will result in a run-time error.

It is possible to determine the application type of a Windows or Amiga application at runtime. The IsConsole constant, declared in the Win32 and Amiga system units as

Const
IsConsole : Boolean;

contains True if the application is a console application, False if the application is a GUI application.

[next] [prev] [prev-tail] [front] [up]