IMG_Load() not working under Windows CE SOL VED

Mason Wheeler <masonwheeler> writes:

Doesn’t look to me like you’re missing anything. If the file exists and
IMG_Load doesn’t load it,
there are 2 possibilities. Either the file isn’t a valid image, or IMG_Load
doesn’t work right on
WinCE. Probably the latter.

Try copying the code from the IMG_Load routine and the specific routine for
your format type
that it calls into your project, so you can trace it more easily and find out
where the point of
failure is. Then you can either submit a patch and improve SDL, or if fixing
it turns out to be
over your head you can at least submit a bugrep with detailed information
about how and where> it fails.

----- Original Message ----
From: Techi <techi>
To: sdl
Sent: Tuesday, December 23, 2008 3:35:21 PM
Subject: [SDL] IMG_Load() not working under Windows CE


I am porting my application from Win32 to Windows CE using SDL 1.2

And I have stucked due to very weird and stupid problem.
I am unable to load any images under Windows CE using SDL_image functions
however those images can be opened using standard fopen() function

images are correct has about few kB (no memory overflow possible)

As you may know Windows CE does not have relative path. All paths must be

I know that SDL uses for file r/w operations native functions, however
TTF_OpenFont() works correctly (using the same file r/w API)

So here is my ghost code (for demonstration using absolute path on my storage

g_font = TTF_OpenFont("\Storage Card\DejaVuSansCondensed.ttf", 16);
printf(“Font loaded\n”);

FILE *fp = fopen("\\Storage Card\\icon.bmp", "rb");

if (fp != NULL)
    printf("image file exists\n");

SDL_Surface* surface;
surface = IMG_Load("\\Storage Card\\icon.bmp");

if (surface == NULL)
    printf("unable to load image, funny\n");

Font loaded
image file exists
unable to load image, funny

Of course I have tried different images and extensions

stderr is empty…

Am I missing something?

Thank You for any suggestions and comments

SDL mailing list


I have started my debugger, jumping to IMG_isPNG() and see that the function
has no body - and I cried What the f*** is going on here?

And yes, the function body was really empty, because in each these IMG_LoadXXX
is testing macro condition

#ifdef LOAD_PNG …

which is however not defined. I assume those macros are defined in project file
(which is missing for VisualCE)

So I had to define those macros and it works fine now however I wonder why
there is this macro condition.

I assume this crazy macro test is due to spare some binary code (and memory) if
targeted image is not used in our program.