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).


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to