> ## 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

> cgSetErrorHandler was introduced in Cg 1.4.

> ## See Also

> cgGetErrorHandler, cgGetError, cgGetErrorString, cgGetFirstError