Detecting Signal/System Messages in Windows and Linux
Posted on 2003-10-31
I'm writing a console app which will be run in both windows and linux environment. I have now run in to a slight problem.
When I close the application the destructors of some objects are not called. So alot of data is just left in the memory.
The console app looks something like this:
dmMain := TdmMain.Create(nil);
The run method is just a dummy which contains a loop so that the application doesnt exit.
Would it be possible to listen for system signals to the program... and when the program recieves kill signals or the user closes the console window or presses control-c?
I would be greatful if someone had two code examples of this... one for windows and one for linux.