# Override the Default Run-Time Library Exception Handler

To override the default run-time library exception handler on Linux* and macOS, your application must call `signal` to change the action for the signal of interest.

For example, assume that you want to change the signal action to cause your application to call `abort()` and generate a core file.

The following example adds a function named `clear_signal_` to call `signal()` and change the action for the `SIGABRT` signal:

    #include <signal.h>
      void clear_signal_() { signal (SIGABRT, SIG_DFL); }

      int myabort_() {
        abort();
        return 0;
    }

A call to the `clear_signal()` local routine must be added to main. Make sure that the call appears before any call to the local `myabort()` routine:

    program aborts
    integer i

    call clear_signal()

    i = 3
    if (i < 5) then
    call myabort()
    end if
    end

Parent topic: Run-Time Errors