Thread: Problem With The Libgd

  1. #1
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465

    Problem With The Libgd

    This code crashes on gdImageGifAnimBegin

    Code:
    #include <gd.h>
    #include <string.h>
    
    int main(int argc, CHAR ** argv)
    {
    
        gdImagePtr im = gdImageCreate(100, 100);
        FILE * out = fopen("anim.gif", "wb");
    
        if(out)
        {
            gdImageGifAnimBegin(im, out, 1, -1);
            gdImageGifAnimEnd(out);
            fclose(out);
        }
    
        gdImageDestroy(im);
        return 0;
    }
    Unhandled exception at 0x7c918fea (ntdll.dll) in Stupid.exe: 0xC0000005: Access violation writing location 0x00000010.

    ntdll.dll!_RtlpWaitForCriticalSection@4() + 0x5b bytes
    ntdll.dll!_RtlEnterCriticalSection@4() + 0x46 bytes
    msvcrt.dll!__lock_file() + 0x33 bytes
    msvcrt.dll!_fwrite() + 0x14 bytes
    bgd.dll!1000c39a()

    I can't understand why it is failing on this section. I am using Microsoft Visual Studio 8, and the shared library DLL is compiled with VC6 under multithreaded mode

    Does anyone know why

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    > FILE * out = fopen("anim.gif", "wb");
    Just out of curiosity, have you tried opening the file in read mode instead of write mode?

  3. #3
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Yeayea.

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    The problem was the that the binary distribution of the libgd that I was using was compiled with VC6, which was incompatible with me. I had to compile the library which was a bit of an ordeal, but I'd like to thank the the libgd support crew. It works now!

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    1
    Hello all,

    I'm having the same problem. Can you give me a summary of how to compile libgd using MS Visual Studio 8, because the version delivered on the site did not worked
    I'm using MSVC 8 on an Windows system.

    Or, can you, please, give me the library compiled by you.. I think it will work.

    I'm disperate, I have to finish a task at work in 3 days and I've already lost this day trying to make it work, but useless.

    Thanks in advance,
    Raz

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM