NAME
    cgGetErrorHandler, cgSetErrorHandler - get and set the error handler
    callback

SYNOPSIS
      #include <Cg/cg.h>

      typedef void (*CGerrorHandlerFunc)(CGcontext context, CGerror err, void *appdata);

      void cgSetErrorHandler(CGerrorHandlerFunc func, void *appdata);
      CGerrorHandlinerFunc cgGetErrorHandler(void **appdataptr);

PARAMETERS
    func    A pointer to the error handler callback function.

    appdata A pointer to arbitrary application-provided data.

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, a context handle of 0 is used.

    err 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.

    cgGetErrorHandler returns the currently error handler callback function.
    NULL will be returned if no callback function is set. The value of the
    current appdata pointer will be copied into the location pointed to by
    appdataptr if appdataptr is not NULL.

    The following is an example of how to set and use an error handler:

      void MyErrorHandler(CGcontext ctx, CGerror err, void *data) {
        char *progname = (char *)data;
        fprintf(stderr, "%s: Error: %s\n", progname, cgGetErrorString(err));
      }

      void main(int argc, char *argv[])
      {
        ...
        cgSetErrorHandler(MyErrorHandler, (void *)argv[0]);
        ...
      }

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

