Specifications

Intel
®
Image Processing Library Reference Manual
3-16
3
application is running under a Windows system or you can choose to send
error messages to a special log file.
There are two methods of adding your own error handler. In the first
method, you can replace the
iplError() function or the complete error
handling library with your own code. Note that this method can only be
used at link time.
In the second method, you can use the iplRedirectError() function to
replace the error handler at run time. The steps below describe how to
create your own error handler and how to use the
iplRedirectError()
function to redirect error reporting.
1. Define a function with the function prototype as follows:
typedef int (_STDCALL *IPLErrorCallBack)
(IPLStatus
status
, const char *
funcname
,
const char *
context
, const char *
file
, int
line
);
2. Your application should then call the iplRedirectError() function
to redirect error reporting for your own function. All subsequent calls
to
iplError() will call your own error handler.
3. To redirect the error handling back to the default handler, simply call
iplRedirectError() with a NULL pointer.
Example 3-4 illustrates a user-defined error handler function,
ownError(),
which simply prints an error message constructed from its arguments and
exits.