cgSetErrorHandler(3)

NAME
cgSetErrorHandler - set the error handler callback function

SYNOPSIS
  #include <Cg/cg.h>
  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, NULL 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 NULL 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));
  }
  void main(int argc, char *argv[])
  {
    ...
    cgSetErrorHandler(MyErrorHandler, (void *)argv[0]);
    ...
  }

ERRORS
to-be-written

HISTORY
cgGetErrorHandler was introduced in Cg 1.4.

SEE ALSO
the cgGetErrorHandler manpage, the cgGetError manpage, the cgGetErrorString manpage, the cgGetFirstError manpage