Skip to content

Commit

Permalink
FreeImage requires a special calling convention for its callbacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
SiegeLordEx authored and SiegeLord committed Nov 21, 2024
1 parent e652daf commit 7273e00
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions addons/image/freeimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,20 @@ ALLEGRO_BITMAP *_al_load_fi_bitmap(const char *filename, int flags)
return bitmap;
}

static unsigned int _fiio_al_read(void *buffer, unsigned size, unsigned count, fi_handle handle) {
/* FreeImage requires stdcall on win32 for these. DLL_CALLCONV is provided by FreeImage.h */
static unsigned int DLL_CALLCONV _fiio_al_read(void *buffer, unsigned size, unsigned count, fi_handle handle) {
return (unsigned int) al_fread((ALLEGRO_FILE *)handle, buffer, (count * size));
}

static unsigned int _fiio_al_write(void *buffer, unsigned size, unsigned count, fi_handle handle) {
static unsigned int DLL_CALLCONV _fiio_al_write(void *buffer, unsigned size, unsigned count, fi_handle handle) {
return (unsigned int) al_fwrite((ALLEGRO_FILE *)handle, buffer, (count * size));
}

static int _fiio_al_fseek(fi_handle handle, long offset, int origin) {
static int DLL_CALLCONV _fiio_al_fseek(fi_handle handle, long offset, int origin) {
return al_fseek((ALLEGRO_FILE *)handle, offset, origin);
}

static long _fiio_al_ftell(fi_handle handle) {
static long DLL_CALLCONV _fiio_al_ftell(fi_handle handle) {
return (long) al_ftell((ALLEGRO_FILE *)handle);
}

Expand Down

0 comments on commit 7273e00

Please sign in to comment.