Error-handling callback functions

An error-handling callback function and a pointer to an error argument (errarg) can be specified by the program analysis application during initialization of libddpi. During initialization of the Ddpi_Info object, the callback function is given by the errhand parameter. If libddpi detects an error and no Ddpi_Error object is specified in the application, the error-handling callback function is called.

Callback function arguments

The callback function passes two arguments:
  • The first argument contains a pointer to a temporary Ddpi_Error object that documents the error.
  • The second argument is the errarg pointer, which is provided as a convenience for the program analysis application. The pointer can be used to pass extra information to the callback function.
If invalid arguments are specified when an libddpi operation is called, the return values are undefined. The error-handling callback function might not be called, and the libddpi operation might abort execution. Examples of invalid arguments are:
  • A NULL pointer to a libddpi operation (except where explicitly permitted)
  • A pointer to an invalid address
  • A pointer to an uninitialized value