#include <tiffio.h>
#include <stdarg.h>
void TIFFWarning(const char *module, const char *fmt, ...)
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt, ...)
typedef void (*TIFFWarningHandler)(const char *module, const char *fmt, va_list ap);
typedef void (*TIFFWarningHandlerExt)(thandle_t fd, const char *module, const char *fmt, va_list ap);
TIFFWarningHandler TIFFSetWarningHandler(TIFFWarningHandler handler)
TIFFWarningHandlerExt TIFFSetWarningHandlerExt(TIFFWarningHandlerExt handler)


TIFFWarning() invokes the library-wide warning handler function to (normally) write a warning message to the stderr. The fmt parameter is a printf() format string, and any number arguments can be supplied. The module parameter is interpreted as a string that, if non-zero, should be printed before the message; it typically is used to identify the software module in which a warning is detected.

Applications that desire to capture control in the event of a warning should use TIFFSetWarningHandler() to override the default warning handler. A NULL (0) warning handler function may be installed to suppress warning messages.

The function TIFFWarningExt() provides a file handle in order to write the warning message to a file. Within libtiff TIFFWarningExt() is called using tif->tif_clientdata as file handle.

With TIFFSetWarningHandlerExt() an extra warning handler can be setup in order to write to a file. The file handle needs to be stored in tif->tif_clientdata if the libtiff internal warnings shall also be written to that file.


In libtiff only a default warning handler is defined, writing the message to stderr. For writing warning messages to file, an extra TIFFWarningHandlerExt function has to be set. TIFFWarning() and TIFFWarningExt() will try to call both handler functions if defined. However, TIFFWarning() will pass "0" as file handle to the extended warning handler.

Return values

TIFFSetWarningHandler() and TIFFSetWarningHandlerExt() returns a reference to the previous warning handling function.

See also

TIFFError (3tiff), libtiff (3tiff), printf (3)