Hello, I have two questions: Is that the proper way to install a signal handler?
program testsignal; uses gpc;
Procedure CatchSignal(sig:integer); begin case sig of 2: writeln('Interrupted'); end; end;
var o:TSignalHandler; b:boolean; i:longint; begin InstallSignalHandler(SigInt,CatchSignal,true,true,o,b); for i:=1 to 2000 do writeln(i); end.
I intended it to be a SIGINT handler, but the Ctrl+C in the console doesn't make the CatchSignal proc executed. I also don't know why I cannot write SigInt as the case label - the compiler complains that SigInt is not a constant or a variable of an ordinal type (but it is declared as an integer in the GPC unit). Any ideas?
The second question I would like to ask is about the 'segmentation fault' I get in one of my progs. I thought it can appear if I try to reference something that is already disposed, but this time my debugger says that it appears where a 'goto' statement is in the code. The executable is quite big (1,7 MB without the -s switch) and maybe that is the problem ? Anyone can tell me what actually the 'segmentation fault' is and what can be the reason of it? Thanks in advance. Regards, Adam Naumowicz
-------------------------------------- WWW: http://math.uwb.edu.pl/~adamn/ --------------------------------------