WSSetSignalHandlerFromFunction (C Function)

installs the Unix signal handler pointed to by sf for signal s in the WSTP library signal-handling mechanism.


  • WSSetSignalHandlerFromFunction() does nothing on Microsoft Windows.
  • sf is a pointer to a signal-handling function of type void (*func)(int). See the header file signal.h on most Unix and Unix-like systems for further details.
  • WSSetSignalHandlerFromFunction() returns WSEOK if no error occurs and one of the other error codes as listed in wstp.h in the event of an error.
  • WSSetSignalHandlerFromFunction() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include <signal.h>
#include "wstp.h"

void h(int signum)
    /* ... */

/* set a SIGHUP signal handler in the WSTP environment */

void f(WSENV ep)
    int err;
    err = WSSetSignalHandlerFromFunction(ep, SIGHUP, (void *)h);
    if(err != WSEOK)
        { /* unable to set the signal handler in ep */ }