[fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

Bart bartjunk64 at gmail.com
Thu Oct 13 11:21:33 CEST 2016

On 10/13/16, Michael Van Canneyt <michael at freepascal.org> wrote:

> Call Terminate and exit properly ?
> TCustomApplication has an exitcode property which will set the global exit
> code.

AFAICS not in fpc 3.0.0

(TATCApp = class(TCustomApplication)

procedure TATCApp.OnExcept(Sender: TObject; E: Exception);
  writeln(Format('An exception has occurred of type %s, with
  writeln('The program will be termminated immediately.');
  if (E is EInOutError) then Self.ExitCode := EInOutError(E).ErrorCode;

air2.lpr(54,35) Error: identifier idents no member "ExitCode"

Probably you can set system.ExitCode before calling Terminate.


More information about the fpc-pascal mailing list