Hi,
Damn it it never works !
So now I am using SDl_Image and I get a weird error when loading a png :
sprite = IMG_Load(“test.png”);
but sprite is NULL because of the following :
lib.png_set_read_fn =
(void (*) (png_structp, png_voidp, png_rw_ptr))
SDL_LoadFunction(lib.handle, “png_set_read_fn”);
if ( lib.png_set_read_fn == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
SDL_LoadFunction returns NULL.
When I trace I can see :
void *SDL_LoadFunction(void *handle, const char *name)
{
void *symbol = NULL;
const char *loaderror = “Unknown error”;
#if defined(_WIN32_WCE)
char errbuf[512];
int length = SDL_strlen(name);
wchar_t *name_t = SDL_malloc((length + 1) * sizeof(wchar_t));
wchar_t *errbuf_t = SDL_malloc(512 * sizeof(wchar_t));
memset(name_t, 0, length+1 * sizeof(name_t));
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, -1, name_t, length);
RETAILMSG(1, (L"SDL_LoadFunction: name_t = [%s]\r\n", name_t));
…
}
I have also added a memset to be sure I don’t have invalid data
SDL_LoadFunction: name_t = [png_create_info_struct]
SDL_LoadFunction: name_t = [png_create_read_struct]
SDL_LoadFunction: name_t = [png_destroy_read_struct]
SDL_LoadFunction: name_t = [png_get_IHDR]
SDL_LoadFunction: name_t = [png_get_io_ptr]
SDL_LoadFunction: name_t = [png_get_tRNS]
SDL_LoadFunction: name_t = [png_get_valid]
SDL_LoadFunction: name_t = [png_read_image]
SDL_LoadFunction: name_t = [png_read_info]
SDL_LoadFunction: name_t = [png_read_update_info]
SDL_LoadFunction: name_t = [png_set_expand]
SDL_LoadFunction: name_t = [png_set_gray_to_rgb]
SDL_LoadFunction: name_t = [png_set_packing]
SDL_LoadFunction: name_t = [png_set_read_fn?]
and I really don’t undertand why there is a space at the end of
png_set_read_fn
because in SDl_Image string is OK…
I am testing on a PPC2003 emulator.