Sign in to follow this  
Boder

VS2005 TIFF Library Crash

Recommended Posts

I am using VS2005 Express to build some example code that uses OpenGL, GLUT, and the TIFF Library. I am using the precompiled TIFF developer package for Windows. The code is not mine, but it keeps crashing (...has encountered a problem and needs to close). Now to hunt down the problem. I am wondering if the problem could be they built it with a different compiler. Here are the dependencies.
    TIFF* tif = NULL;
    int idx;
    for( idx = 0; idx < ogld::OGLDif::instance()->getDataPathSize(); idx++)
    {
        std::string fullPath = ogld::OGLDif::instance()->getDataPath( idx ) + fileName;
        tif = TIFFOpen( fullPath.c_str(), "r" );
        if (tif)
            break;
    }
    if (!tif)
        return false;

    uint32 w, h;
    size_t npixels;
    uint16 photometric;
    uint16 config;
    uint16 samples;

    TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photometric ); // CRASH!!!!!
    assert( photometric == PHOTOMETRIC_RGB );
    TIFFGetField( tif, TIFFTAG_PLANARCONFIG, &config );
    assert( config == PLANARCONFIG_CONTIG );

Share this post


Link to post
Share on other sites
I've never used this library but according to what I've read on other websites, your usage seems correct.

Did you try running it in a debugger? At least to know what's the "crash"?

Are you sure its not your assert function that's crashing? I've seen assert implementations that did ugly things (such as *(int*)0 = 0; to "stop" the execution)

Cheers

Share this post


Link to post
Share on other sites
Well this is annoying.

Express decides to tell me (for the Debug version):

---------------------------
This application has failed to start because MSVCP80D.dll was not found. Re-installing the application may fix this problem.
---------------------------

EDIT: The DLL error went away so I was able to use the debugger. I found it definitely fails on that function call. Access violation reading location 0x00000245.

[Edited by - Boder on May 1, 2006 1:25:49 AM]

Share this post


Link to post
Share on other sites
Somehow the TIFF structure isn't allocated properly, I'm wondering if MSVCRT could be not allowing allocation.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this