Cg Core Runtime API cgSetErrorHandler(3)
NAME
cgSetErrorHandler - set the error handler callback function
SYNOPSIS
#include
typedef void (*CGerrorHandlerFunc)( CGcontext context,
CGerror error,
void * appdata );
void cgSetErrorHandler( CGerrorHandlerFunc func,
void * appdata );
PARAMETERS
func A pointer to the error handler callback function.
appdata A pointer to arbitrary application-provided data.
RETURN VALUES
None.
DESCRIPTION
cgSetErrorHandler specifies an error handler function that
will be called every time a Cg runtime error occurrs. The
callback function is passed:
context
The context in which the error occured. If the context
cannot be determined, NUL is used.
error
The enumerant of the error triggering the callback.
appdata
The value of the pointer passed to cgSetErrorHandler.
This pointer can be used to make arbitrary application-
side information available to the error handler.
To disable the callback function, specify a NUL callback
function pointer via cgSetErrorHandler.
EXAMPLES
void MyErrorHandler(CGcontext context, CGerror error, void *data) {
char *progname = (char *)data;
fprintf(stderr, "%s: Error: %s\n", progname, cgGetErrorString(error));
}
Cg Toolkit 2.1 Last change: 1
Cg Core Runtime API cgSetErrorHandler(3)
void main(int argc, char *argv[])
{
...
cgSetErrorHandler(MyErrorHandler, (void *)argv[0]);
...
}
ERORS
to-be-written
HISTORY
cgSetErrorHandler was introduced in Cg 1.4.
SEE ALSO
cgGetErrorHandler, cgGetError, cgGetErrorString,
cgGetFirstError
Cg Toolkit 2.1 Last change: 2
|