SDL_image: Compiling w/ BCC & loading animated GIF

Hi all,

Two questions about SDL_image. First, is there anything special I need to
do in order to properly export the image loading functions when compiling
under borland’s free compiler? I managed to compile the SDL_image source
which produced a 45k dll but none of the the appropriate functions are
exported. The lib file produced from the resulting dll is just empty.

Second, how does SDL_image handle the loading of animated GIF files. Does
it just load the first frame to a surface and that’s it or does it do more?
For example, loading the other frames of the animation to array of surface
or whatever and saving the animation timing somewhere.

Thanks

Hi all,

Two questions about SDL_image. First, is there anything special I need to
do in order to properly export the image loading functions when compiling
under borland’s free compiler? I managed to compile the SDL_image source
which produced a 45k dll but none of the the appropriate functions are
exported. The lib file produced from the resulting dll is just empty.

A DLL (compiled from any compiler) cannot export anything due to the
fact that Microsoft goofed when they designed the library format. DLLs
that export stuff use a small .lib file, except many compilers fail to
do this, or fail to do it correctly, as they expect some voodoo magic in
a header to fix this. (Dont ask me how that works). It seems bcc is
producing bad .lib files.

You should be able to use the SDL_image binary on the sdl website fine
with bcc.

Second, how does SDL_image handle the loading of animated GIF files. Does
it just load the first frame to a surface and that’s it or does it do more?
For example, loading the other frames of the animation to array of surface
or whatever and saving the animation timing somewhere.

It doesnt.On 08-Jun-2004, Vivi Orunitia wrote:


Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." – Kristian Wilson, Nintendo, Inc, 1989
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040608/1d3e76d1/attachment.pgp

I must add that the way DLLs export symbols is not a MS invention.

I remember having to do the same for Aix libraries.

Patrick McFarland wrote:>On 08-Jun-2004, Vivi Orunitia wrote:

Hi all,

Two questions about SDL_image. First, is there anything special I need to
do in order to properly export the image loading functions when compiling
under borland’s free compiler? I managed to compile the SDL_image source
which produced a 45k dll but none of the the appropriate functions are
exported. The lib file produced from the resulting dll is just empty.

A DLL (compiled from any compiler) cannot export anything due to the
fact that Microsoft goofed when they designed the library format. DLLs
that export stuff use a small .lib file, except many compilers fail to
do this, or fail to do it correctly, as they expect some voodoo magic in
a header to fix this. (Dont ask me how that works). It seems bcc is
producing bad .lib files.

Hi all,

Hi!

Two questions about SDL_image. First, is there anything special I need to
do in order to properly export the image loading functions when compiling
under borland’s free compiler? I managed to compile the SDL_image source
which produced a 45k dll but none of the the appropriate functions are
exported. The lib file produced from the resulting dll is just empty.

You must define which image formats you want to use with SDL_Image at
compile time. For example, to compile SDL_Image with GIF, PNG and JPEG
support you must pass -DLOAD_GIF -DLOAD_JPG -DLOAD_PNG to the compiler.

Second, how does SDL_image handle the loading of animated GIF files. Does
it just load the first frame to a surface and that’s it or does it do more?
For example, loading the other frames of the animation to array of surface
or whatever and saving the animation timing somewhere.

It doesn’t. I didn’t test if it returns just the first frame or if it just
fails, though. If you just want to load and display little animations in
your application maybe you find my SDL_Flic library useful:

Thanks

Hope this helps.

Andre de Leiradella

Andre de Leiradella wrote in
news:000701c44d86$b0791c20$dd70e40d at bra.xerox.com:

You must define which image formats you want to use with SDL_Image at
compile time. For example, to compile SDL_Image with GIF, PNG and JPEG
support you must pass -DLOAD_GIF -DLOAD_JPG -DLOAD_PNG to the
compiler.

I did include those switches when compiling but still doesn’t allow me to
properly export the needed functions. An interesting observation though
is that the SDL source seems to be configured in a similar way (makes
sense since the same author worked on SDL_image too) but I have no
problems compiling that under bcc. The necessary functions for SDL was
exported properly in the dll that was produced. So far I’m having no luck
figuring out the difference between how SDL’s source is configured vs
SDL_image’s source. Unlike SDL, SDL_image doesn’t come with a makefile
for bcc so I did kind of have to make one myself. Maybe there’s a problem
with the way I configured it? Here’s how it looks like:#========================================================================

Borland Makefile – created using AutoBake 1.06

Project: SDL_image

TimeStamp: Tue Jun 01 19:45:46 2004

#========================================================================

#SDL_image Macro Definitions

Build Types:

DebugBuild – Debug Compile

ReleaseBuild – Release Compile

Project Types:

Con – Console, Win – Windows

DLL – Dynamic Link Lib, SLIB – Static Lib

Compiling Options:

RT – dynamic runtime, MT – multi-threaded

WIDE – Unicode/Wide

API & Framework presets:

SDL – SDL presets, wxWindows – wxWindows presets

DLL = 1
MT = 1
ReleaseBuild = 1

#Project Properties
Project = SDL_image
ProjectPath = E:\Borland\BCC55\SDL-1.2.6\SDL_image
BuildOutput = SDL_image
ProjCFlags = -x -w- -I".\include\libjpeg";".\include\libpng";".\include
\zlib" -O2 -DNDEBUG;WIN32;
_WINDOWS;LOAD_BMP;LOAD_GIF;LOAD_LBM;LOAD_PCX;LOAD_PNM;LOAD_XPM;LOAD_JPG;L
OAD_PNG;LOAD_TGA;PNG_USE_DLL;ZLIB_DLL;WIN32;BUILD_SDL;
FREEBCC;ENABLE_WINDIB;ENABLE_DIRECTX;HAVE_ALLOCA=
1;HAVE_OPENGL;STRICT;_NO_VCL
ProjLFlags = -t -L"E:\Borland\BCC55\SDL-1.2.6\SDL_image\lib"
ProjRFlags =
ProjLib = libpng.lib zlib.lib libjpeg.lib SDL.lib

OBJ =
IMG.obj
IMG_pnm.obj
IMG_tga.obj IMG_tif.obj
IMG_xcf.obj
IMG_xpm.obj
IMG_xxx.obj
IMG_bmp.obj IMG_gif.obj IMG_jpg.obj
IMG_pcx.obj IMG_png.obj
IMG_lbm.obj

RES =

DEF = E:\Borland\BCC55\SDL-1.2.6\SDL_image\SDL_image.def

#Borland Makefile Directives
.autodepend
.nosilent
.path.obj = E:\Borland\BCC55\SDL-1.2.6\SDL_image\Bin
.path.cpp = E:\Borland\BCC55\SDL-1.2.6\SDL_image
.path.exe = $(.path.obj)
.path.dll = $(.path.obj)
.path.lib = $(.path.obj)
.path.asm = $(.path.obj)
.path.res = $(.path.obj)

!include $(MAKEDIR)…\bcc32proj.mak

It doesn’t. I didn’t test if it returns just the first frame or if it
just fails, though. If you just want to load and display little
animations in your application maybe you find my SDL_Flic library
useful: http://www.geocities.com/andre_leiradella/#sdl_flic

Thanks. I’ll be sure to take a look at that. :slight_smile:

Patrick McFarland wrote in
news:20040608100821.GA6210 at panax.com:

–82I3+IH0IqGh5yIs

A DLL (compiled from any compiler) cannot export anything due to the
fact that Microsoft goofed when they designed the library format. DLLs
that export stuff use a small .lib file, except many compilers fail to
do this, or fail to do it correctly, as they expect some voodoo magic
in a header to fix this. (Dont ask me how that works). It seems bcc is
producing bad .lib files.

You should be able to use the SDL_image binary on the sdl website fine
with bcc.

I’m not quite sure I completely get what you mean. As I understand dll’s,
the functions to be exported have to be declared a certain way in order to
be visible to programs or whatever components using that dll. I believe
something along the lines of this for instance:

int __declspec(dllexport) Foo(Blah blah);

I thought that somewhere in the SDL_image source it would have macros
defined for this so that the functions are exported properly when compiling
the dll. It got me wondering whether a specific macro had to be defined for
the declarations to be preprocessed properly.

It doesnt.

Oh well, I guess I’ll take a look at Andre de Leiradella’s link about this
then.

Thanks> On 08-Jun-2004, Vivi Orunitia wrote:

You must define which image formats you want to use with SDL_Image at
compile time. For example, to compile SDL_Image with GIF, PNG and JPEG
support you must pass -DLOAD_GIF -DLOAD_JPG -DLOAD_PNG to the
compiler.

I did include those switches when compiling but still doesn’t allow me to
properly export the needed functions. An interesting observation though

Hummm… Try adding a defining DECLSPEC as __declspec(dllexport) before
compiling. I’m not sure this will help as I’m compiling static versions of
the libraries. This should mark the funtions to be exported by the DLL.

is that the SDL source seems to be configured in a similar way (makes
sense since the same author worked on SDL_image too) but I have no
problems compiling that under bcc. The necessary functions for SDL was
exported properly in the dll that was produced. So far I’m having no luck
figuring out the difference between how SDL’s source is configured vs
SDL_image’s source. Unlike SDL, SDL_image doesn’t come with a makefile
for bcc so I did kind of have to make one myself. Maybe there’s a problem
with the way I configured it? Here’s how it looks like:

I’m not a Makefile expert, I can’t help you here.

Regards,

Andre de Leiradella