How to catch a signal

W.Boeke w.boeke at upcmail.nl
Sat Nov 9 12:44:20 UTC 2019


I am trying to catch a signal from the OS, as follows:

int winch;

void set_winch (int sig) {
   enum SIGWINCH = 28;
   signal.signal(SIGWINCH,cast(void function(int))set_winch);
   winch = sig;
}

The SIGWINCH signal notifies a window resize. In C this works 
(without the cast), but in D I get a compilation error:

Error: function signal.set_winch(int sig) is not callable using 
argument types ()
        missing argument for parameter #1: int sig

What should be the right way to accomplish this?
Thanks in advance for your answer.

Wouter



More information about the Digitalmars-d-learn mailing list