[fpc-pascal] modifying system.pp's InstallSignals

Vincent Snijders vsnijders at vodafonevast.nl
Tue Mar 31 15:53:02 CEST 2009


Seth Grover schreef:
> 
> Does that seem like the right way for me to get the functionality of
> those calls available to me in InstallSignals? Or is there something
> easier I'm missing?
> 

I don't think it can be done without editing the system unit. If you are willing to 
do that, I would add a procvar called CustomSignalHandler: TProcedure in the 
interface section of the system unit (or in an include file included in the 
interface section of the system unit).

In the signal handler of the system unit, test assigned(CustomSignalHandler) and 
call it, if it is assigned, else do the current thing.

Create a new unit MySignalHandlerUnit that contains your signal handler and that has
procedure MySignalHandler in its interface.
In the initialization section do
   System.CustomSignalHandler := @MySignalHandler;

Add MySignalHandlerUnit  to the uses section of your main program.

Vincent

P.S. I am sure you can find better names.



More information about the fpc-pascal mailing list