# TIFFOpenOptions

## Synopsis

    #include <tiffio.h>

typedef TIFFOpenOptions TIFFOpenOptions

TIFFOpenOptions *TIFFOpenOptionsAlloc(void)

void TIFFOpenOptionsFree(TIFFOpenOptions*)

void TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts, tmsize_t max_single_mem_alloc)

void TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions *opts, TIFFErrorHandlerExtR handler, void *errorhandler_user_data)

void TIFFOpenOptionsSetWarningHandlerExtR(TIFFOpenOptions *opts, TIFFErrorHandlerExtR handler, void *warnhandler_user_data)

## Description

`TIFFOpenOptions` is an opaque structure which can be passed to the TIFF open”Ext” functions to define some `libtiff` internal settings. The settings are the maximum single memory allocation limit and per-TIFF handle (re-entrant) error handler and warning handler functions. For those handler a pointer to a custom defined data structure user_data can be given along.

`TIFFOpenOptionsAlloc()` allocates memory for the `TIFFOpenOptions` opaque structure and returns a `TIFFOpenOptions` pointer.

`TIFFOpenOptionsFree()` releases the allocated memory for `TIFFOpenOptions`. The allocated memory for `TIFFOpenOptions` can be released straight after successful execution of the related TIFF open”Ext” functions like `TIFFOpenExt()`.

`TIFFOpenOptionsSetMaxSingleMemAlloc()` sets parameter for the maximum single memory limit in byte that `libtiff` internal memory allocation functions are allowed to request per call.

`TIFFOpenOptionsSetErrorHandlerExtR()` sets the function pointer to an application-specific and per-TIFF handle (re-entrant) error handler. Furthermore, a pointer to a custom defined data structure errorhandler_user_data can be passed. This error handler is invoked through `TIFFErrorExtR()` and the errorhandler_user_data pointer is given along. The errorhandler_user_data argument may be NULL.

`TIFFOpenOptionsSetWarningHandlerExtR()` works like `TIFFOpenOptionsSetErrorHandlerExtR()` but for the warning handler, which is invoked through `TIFFWarningExtR()`

## Note

This functionality was introduced with libtiff 4.5.

## See also

libtiff (3tiff), TIFFOpen (3tiff), TIFFError (3tiff), TIFFWarning (3tiff)