[cl-gd-devel] Re: GIF image handling?

Edi Weitz edi at agharta.de
Fri Nov 26 13:45:36 UTC 2004


On Thu, 18 Nov 2004 11:46:43 -0800 (PST), joe fred <bihuziro at volcanomail.com> wrote:

> GD does look like it would work for me and there is a pre-compiled
> windows library for it at
>
> http://www.boutell.com/gd/manual2.0.33.html#getgd (NOTE: the library
> file there is called "bgd.dll" instead of "gd.dll".)
>
> I'm able to compile cl-gd-glue-gif.c ok with
>    gcc -Id:/local/graphics/gd/gdwin32 -c cl-gd-glue-gif.c
>
> Unfortunately, I'm not able to link cl-gd-glue-gif.o, see below.
> Apparently six years of Java have atrophied my windows' C skills
> down to the most basic level.
>
> Thanks to Harley and Edi for their help, but it looks like I'll need
> to spend some time relearning basic C linking before I get on with
> GD & cl-gd.
>
> ld -Ld:/local/graphics/gd/gdwin32 -lbgd -lz -lpng -ljpeg -lfreetype -lm -liconv -lbgd -shared cl-gd-glue-gif.o -o cl-gd-glue-gif.dll
> cl-gd-glue-gif.o(.text+0x16):cl-gd-glue-gif.c: undefined reference to `fopen'
> cl-gd-glue-gif.o(.text+0x2a):cl-gd-glue-gif.c: undefined reference to `gdImageCreateFromJpeg'
> cl-gd-glue-gif.o(.text+0x50):cl-gd-glue-gif.c: undefined reference to `fclose'
> cl-gd-glue-gif.o(.text+0x60):cl-gd-glue-gif.c: undefined reference to `__errno'
> cl-gd-glue-gif.o(.text+0x8e):cl-gd-glue-gif.c: undefined reference to `fopen'
> cl-gd-glue-gif.o(.text+0xa2):cl-gd-glue-gif.c: undefined reference to `gdImageCreateFromGif'
> cl-gd-glue-gif.o(.text+0xc8):cl-gd-glue-gif.c: undefined reference to `fclose'
> cl-gd-glue-gif.o(.text+0xd8):cl-gd-glue-gif.c: undefined reference to `__errno'
> cl-gd-glue-gif.o(.text+0x106):cl-gd-glue-gif.c: undefined reference to `fopen'
> cl-gd-glue-gif.o(.text+0x11a):cl-gd-glue-gif.c: undefined reference to `gdImageCreateFromPng'
> cl-gd-glue-gif.o(.text+0x140):cl-gd-glue-gif.c: undefined reference to `fclose'
> cl-gd-glue-gif.o(.text+0x150):cl-gd-glue-gif.c: undefined reference to `__errno'
> cl-gd-glue-gif.o(.text+0x17e):cl-gd-glue-gif.c: undefined reference to `fopen'
> cl-gd-glue-gif.o(.text+0x192):cl-gd-glue-gif.c: undefined reference to `gdImageCreateFromGd'
> cl-gd-glue-gif.o(.text+0x1b8):cl-gd-glue-gif.c: undefined reference to `fclose'
> cl-gd-glue-gif.o(.text+0x1c8):cl-gd-glue-gif.c: undefined reference to `__errno'
> cl-gd-glue-gif.o(.text+0x1f6):cl-gd-glue-gif.c: undefined reference to `fopen'
> cl-gd-glue-gif.o(.text+0x20a):cl-gd-glue-gif.c: undefined reference to `gdImageCreateFromGd2'
> cl-gd-glue-gif.o(.text+0x230):cl-gd-glue-gif.c: undefined reference to `fclose'
> cl-gd-glue-gif.o(.text+0x240):cl-gd-glue-gif.c: undefined reference to `__errno'
> cl-gd-glue-gif.o(.text+0x26e):cl-gd-glue-gif.c: undefined reference to `fopen'
> cl-gd-glue-gif.o(.text+0x29e):cl-gd-glue-gif.c: undefined reference to `gdImageCreateFromGd2Part'
> cl-gd-glue-gif.o(.text+0x2c4):cl-gd-glue-gif.c: undefined reference to `fclose'
> cl-gd-glue-gif.o(.text+0x2d4):cl-gd-glue-gif.c: undefined reference to `__errno'
> cl-gd-glue-gif.o(.text+0x302):cl-gd-glue-gif.c: undefined reference to `fopen'
> cl-gd-glue-gif.o(.text+0x316):cl-gd-glue-gif.c: undefined reference to `gdImageCreateFromXbm'
> cl-gd-glue-gif.o(.text+0x33c):cl-gd-glue-gif.c: undefined reference to `fclose'
> cl-gd-glue-gif.o(.text+0x34c):cl-gd-glue-gif.c: undefined reference to `__errno'

This may come a bit too late but I had some spare hours today and
managed to build GD with MingW. I rebuilt it with __cdecl instead of
__stdcall and put the code of cl-gd-glue-gif.c (with the proper
declarations) directly into gd.c. (Some fiddling was needed because
the configure script didn't find the freetype library although it was
there but basically it worked fine.) The result is here:

  <http://weitz.de/files/cl-gd-glue.dll>

This is based on GD 2.0.33 and works fine for me with AllegroCL 6.2
trial and LispWorks 4.3.7 pro on Windows XP pro SP2.

In order to use it you should do the following:

1. Download the file from above and put it into the CL-GD folder.

2. Download all the necessary support libs from the GnuWin32 project -
   see <http://gnuwin32.sourceforge.net/> - and put the corresponding
   DLLs into the folder where your Lisp image starts up (or somewhere
   else where your FFI will find them).

3. No need to download bgd.dll (the GD library) itself because it's
   already part of cl-gd-glue.dll.

4.   (push :cl-gd-gif *features*)

   in order to get GIF support (which is compiled into the DLL).

5. Compile and load CL-GD, make sure to remove old FASL files in case
   you had previously built CL-GD without GIF support.

That's it. If you run the tests you'll see three failed tests but no
error messages. This is OK - see the CL-GD documentation for details.

Let me know if this works for you. If I'm not the only one who
succeeds with this setup I'll update the CL-GD docs accordingly.

Cheers,
Edi.




More information about the Cl-gd-devel mailing list