Build giflib for Windows using Visual Studio 2010/2015Submitted by Issam Ali on Sat, 02/20/2016 - 13:08
Giflib is c library which can be used to read/write the GIF file format. Even giflib is an old library but still very helpful and many libraries/tools still depend on it.
giflib-4.1.4 has Windows Visual studio package, you can find it here, this package is for visual studio 6 which is also an old version but I think it will be easy to convert this project into newer visual studio versions.
giflib5.x (current version giflib-5.1.2) is hosted in sourceforge here and can be downloaded from here. giflib5.x does not have a visual studio package, of course windows version still could be built using mingw, but here we want visual studio. The code needs some changes to make it (combatable) with the Microsoft c compiler, especially in visual studio 2010 which does not support c99. I made these changes and I added a visual studio 2010/2015 packages ready to build. You can download the new source code from here. To build the library, go to
windows directory, choose a visual studio package and build it.
Note: I did not change the library core/process code; the source code still compatible with the other platforms and also ready to build with other compilers gcc/mingw …
About the utilities /samples
giflib comes with some samples/utilities source code that you can learn a lot from them. You can find these samples in the
util directory. The code of these samples was originally designed in Linux so I made some changes to these samples to make it possible to build with Microsoft c compiler without breaking its compatibility with the other compilers. Also I added a batch file
util\buildall.bat. You can use this batch file to build all samples all together. Just open Visual Studio Command Prompt, navigate to the
util directory and run
buildall.bat this will build all the samples into
bin directory. Make sure before run the samples that giflib5.dll exists in the
bin directory. You may need some *tricks* while testing these utilities. e.g. gifecho sample (named text2gif in version 4.1.4) generates GIF image page from a given text and dump this gif image memory into screen. So if you type gifecho –t “HelloWorld” it will make a gif image and dump its memory into the command prompt which may not the fancy result that you look for. In this case to see this image we need to save this dumped memory into gif file like this gifecho –t “HelloWorld” > out.gif then you can preview this out.gif file like any gif image.