2006.08.03 21:38 "RE: [Tiff] libTiff and MSVC 6.0", by
I am working with the Windows port of libtiff (v3.8.2) and MS Visual
Studio 6.0. I am running into a strange problem and I hope that someone
on the list can help me out.
The following code is compiled as a multithreaded DLL and will throw
an exception after TIFFOpen is called:
If I comment out the TIFFSetField and TIFFClose commands, I can get
an 8 bit file with the correct name (and presumably, the correct
header). If I add two or even three more TIFFOpen commands, they are
all opened correctly. Whenever I try to call any other command though,
the parent that calls the DLL catches an exception.
The above code is simple enough and doesn't appear to contain any obvious bugs. Am I screwing anything up here? Does anyone have any experience making a Windows DLL with libtiff and MSVC6?
What time of exception is it? Null deref, or something more sneaky?
I think I remember seeing something sketchy in TIFFClose (a potential null-deref that would only happen in some cases, but I really can't remember off-hand).
Have you tried building a static version? Does the same thing happen? Perhaps it's more easily traced.
One final idea, check the TIFF spec to make sure you're including all mandatory fields (I see there's no PhotometricInterpretation (I think it's mandatory in consideration of your other tags). You seem to be creating a 16-bit greyscale image; is that correct?