HP MLIB User's Guide Vol. 2 7th Ed.
1094 HP MLIB User’s Guide
Error handling
Figure A-4 Default VECLIB error handling in a C program
% cat vsig1.c
#include <veclib.h>
main ()
{
int n = 1;
float alpha = 0.0;
float x[10];
int incx = 0;
sflr1c (&n, &alpha, x, &incx);
}% cc vsig1.c -lveclib
% a.out
****************************************************************************
* XERVEC: subprogram SFLR1C called with invalid value of argument number 4 *
****************************************************************************
IOT trap (core dumped)
% echo $status
134
The fourth argument, incx, in the call to VECLIB subprogram SFLR1C must
be nonzero. When SFLR1C detects that it is zero, it calls the error handler
XERVEC, which writes the error message and raises signal SIGIOT. Because
no signal handler has been enabled for this signal, the system writes a core
image file and terminates the process.
NOTE If the user has a signal handler that is enabled by the SIGIOT signal,
that signal handler is executed if default error handling is in effect.
As a C programmer, you can alter this default behavior or change the
signal used to any other valid signal (as given in signal(3c)), as shown in
the next section.
Changing the error handler signal
VECLIB includes a C-callable function, initMLIB, that can be used to change
the signal used by the standard error handlers to something other than
SIGIOT. Usage is:
#include <signal.h>
int initMLIB(sig)
int sig;
Sig is 0 or one of the signal numbers or names as given in /usr/include/signal.h.
The specified signal is used instead of the default signal, SIGIOT, if one of the
error handlers is called. If sig is 0, SIGIOT is used. In addition, a simple signal
handler is installed that executes exit(1) to terminate execution with a
nonzero exit status. This is the C equivalent to executing a Fortran STOP
statement.