[fpc-pascal] ExitProc

Michael Van Canneyt michael at freepascal.org
Thu Jun 29 14:57:36 CEST 2006

On Thu, 29 Jun 2006, Jonas Maebe wrote:

> On 29 jun 2006, at 13:51, Carsten Bager wrote:
>> If I compile and run my example program and then press Crtl+C the
>> program terminates. I would expect that it terminate by calling
>> "CloseServer" procedure, but it dos not. If the program terminates
>> normally (time runs out) the "CloseServer" procedure is called as
>> expected.
>> Have I misunderstood something about the ExitProc.
> ExitProc is only called if your program exits via the RTL. This is the case 
> when the program exits normally, or when a run time error or unhandled 
> exception occurs.
> ctrl-c is not caught by the FPC RTL. This means it is handled by the 
> operating system, and the default action of the operating system is to simply 
> terminate the process. The FPC RTL therefore does not get any chance to call 
> your exitproc.
> I don't know whether there's a platform-independent way in the RTL to turn on 
> the catching of ctrl-c (and converting it to an exception or run time error).

Not that I am aware of...


More information about the fpc-pascal mailing list