vmlSetErrorCallBack

Sets the additional error handler callback function and gets the old callback function.

Syntax

FORTRAN:

oldcallback = vmlseterrorcallback( callback )

C:

oldcallback = vmlSetErrorCallBack( callback );

Include Files

Input Parameters

Name

Description

FORTRAN: callback

Address of the callback function.

The callback function has the following format: INTEGER FUNCTION ERRFUNC(par)
TYPE (ERROR_STRUCTURE) par
! ...
! user error processing
! ...
ERRFUNC = 0
! if ERRFUNC= 0 - standard VML error handler
! is called after the callback
! if ERRFUNC != 0 - standard VML error handler
! is not called
END

The passed error structure is defined as follows: TYPE ERROR_STRUCTURE SEQUENCE
INTEGER*4 ICODE
INTEGER*4 IINDEX
REAL*8 DBA1
REAL*8 DBA2
REAL*8 DBR1
REAL*8 DBR2
CHARACTER(64) CFUNCNAME
INTEGER*4 IFUNCNAMELEN
REAL*8 DBA1IM
REAL*8 DBA2IM
REAL*8 DBR1IM
REAL*8 DBR2IM
END TYPE ERROR_STRUCTURE

C: callback

Pointer to the callback function.

The callback function has the following format: static int __stdcall MyHandler(DefVmlErrorContext*
pContext)
{
   /* Handler body */
};

The passed error structure is defined as follows: typedef struct _DefVmlErrorContext
{
int iCode;/* Error status value */
int iIndex;/* Index for bad array
   element, or bad array
   dimension, or bad
   array pointer */
double dbA1; /* Error argument 1 */
double dbA2; /* Error argument 2 */
double dbR1; /* Error result 1 */
double dbR2; /* Error result 2 */
char cFuncName[64]; /* Function name */
int iFuncNameLen; /* Length of functionname*/
double dbA1Im; /* Error argument 1, imag part*/
double dbA2Im; /* Error argument 2, imag part*/
double dbR1Im; /* Error result 1, imag part*/
double dbR2Im; /* Error result 2, imag part*/
} DefVmlErrorContext;

Output Parameters

Name

Type

Description

oldcallback

Fortran 90: INTEGER

C: int

FORTRAN: Address of the former callback function.

C: Pointer to the former callback function.

Note iconNote

This function does not have a FORTRAN 77 interface due to the use of internal structures.

Description

The callback function is called on each VML mathematical function error if VML_ERRMODE_CALLBACK error mode is set (see "Values of the mode Parameter").

Use the vmlSetErrorCallBack() function if you need to define your own callback function instead of default empty callback function.

The input structure for a callback function contains the following information about the error encountered:

You can insert your own error processing into the callback function. This may include correcting the passed result values in order to pass them back and resume computation. The standard error handler is called after the callback function only if it returns 0.


Submit feedback on this help topic