12 error handling routines – Scotch Brand 5.1.10 User Manual

Page 120

Advertising
background image

7.12

Error handling routines

The handling of errors that occur within library routines is often difficult, because
library routines should be able to issue error messages that help the application
programmer to find the error, while being compatible with the way the application
handles its own errors.

To match these two requirements, all the error and warning messages pro-

duced by the routines of the libScotch library are issued using the user-definable
variable-length argument routines SCOTCH errorPrint and SCOTCH errorPrintW.
Thus, one can redirect these error messages to his own error handling routines, and
can choose if he wants his program to terminate on error or to resume execution
after the erroneous function has returned.

In order to free the user from the burden of writing a basic error handler

from scratch, the libscotcherr.a library provides error routines that print error
messages on the standard error stream stderr and return control to the applica-
tion. Application programmers who want to take advantage of them have to add
-lscotcherr

to the list of arguments of the linker, after the -lscotch argument.

7.12.1

SCOTCH errorPrint

Synopsis

void SCOTCH errorPrint (const char * const

errstr, ...)

Description

The SCOTCH errorPrint function is designed to output a variable-length ar-
gument error string to some stream.

7.12.2

SCOTCH errorPrintW

Synopsis

void SCOTCH errorPrintW (const char * const

errstr, ...)

Description

The SCOTCH errorPrintW function is designed to output a variable-length
argument warning string to some stream.

7.12.3

SCOTCH errorProg

Synopsis

void SCOTCH errorProg (const char *

progstr)

Description

120

Advertising