2007.03.09 21:20 "[Tiff] Regarding NULL TIFFOpen return on Windows", by W Bradford Paley

2007.03.12 17:27 "[Tiff] Problem fixed: TIFFOpen() returns NULL on MS VC++", by W Bradford Paley

Dear all,

This problem has been fixed, and I'm happily using this generously-given and -supported library. Thanks!

It's more of a newbie/Microsoft/linking issue but I am posting the minimum useful exchange, with great advice from Edward Lam, in case it's useful to another person in this situation. Strange: would have been nice if the process had died in some more expository way, like being unable to link at all.

To restate the problem for archive divers: I installed the latest version of LibTIFF using the GnuWin32 binaries, and got a NULL return from TIFFOpen(), even when I knew the call should work. (I knew it should work because I downloaded an earlier version of LibTIFF that someone had packaged as a VC++ project, and it compiled & linked & ran fine; no NULL.)

Best Regards,
Brad

>Eureka. You're the best--very complete resources & >clear directions for me. And you even made me feel >like it wasn't my fault. Neat.

>

>I compiled the library (I thankfully don't need the >zlib & jpeg support) and unified all my code to the >/MD compiler option, and it works. What used to be >3Mb files are now being output (using LZW) as 25k.

>
>At 01:51 AM 3/11/2007, you wrote:

On Sat, March 10, 2007 2:52, W Bradford Paley said:

Wondering whether I was misusing the library was what prompted me to find and build that other version. Once I linked with that one, TIFFOpen() with the exact same parameters worked fine.

You have probably hit upon CRT Hell (CRT = C Run-Time Library), which is a variant of DLL Hell. To make a long story short, the libtiff library and your application must be compiled to use the same CRT library. ie. you must compile the latest version of libtiff yourself. It's not hard. See:

    http://remotesensing.org/libtiff/build.html#PC

Unfortunately, if you need JPEG or Deflate support, you will also need to build your own libjpeg and zlib. I just noticed that www.zlib.net has long FAQ on their own CRT issues:

    http://www.zlib.net/DLL_FAQ.txt

Anyhow, building zlib and libjpeg are not that hard either. You just need some patience. :)

The long explanation: MSVC .Net 2003 and MSVC 2005 use different, incompatible versions of the CRT library. I'm guessing that you're using MSVC 2005 and GnuWin32 is using MSVC .Net 2003. It's a general mess right now from my personal vantange point. For some info, you this link also has some more info:

    http://msdn2.microsoft.com/en-us/library/ms235460(VS.80).aspx

W. Bradford Paley

Digital Image Design Incorporated 170 Claremont Suite 6 New York NY 10027
http://didi.com/brad http://informationEsthetics.org http://textarc.org
http://google.com/search?&q=%22Brad+Paley%22+OR%22+Bradford+Paley%22+-flash
(917) 686-3274

This document may contain information that is privileged and confidential.
Do not disseminate to others without explicit written permission.