2004.06.28 13:18 "[Tiff] Throwing C++ exceptions from custom error handler", by Fieleke, Eric
I've written a thin C++ wrapper around 3.6.1 tifflib, primarily because I'd like to coerce it to throw C++ exceptions when library methods fail. What I'm doing is passing a function to TIFFSetErrorHandler that constructs and throws a C++ exception. I have a few questions about this:
* Is it guaranteed that any time a TIFF library method fails that the error handler will get called?
* Is it guaranteed that any time a TIFF library method succeeds that the error handler will NOT get called?
* Is allocated memory always cleaned up before the library calls the error handler method (i.e. will there be leaks if I throw an exception from within the error handler)? If it's not, I could throw exceptions after testing the return code from the TIFF library methods rather than from within the error handler method.
* Am I reinventing the wheel? Is there a well-tested, publicly available and free C++ wrapper for tifflib?
Thanks for your help.