As already written in the compiler forum, I finally managed to compile, link and run my game on Mac OS X. The game has two output modes, a console mode where it runs in a 80x25 terminal, and a graphical mode using SDL.

The console mode works just fine, as does the SDL mode, as long as my game window is only 800x600 big.

When I try to open a 1024x768 window, the game crashes with an invalid floating point operation. I have isolated the error so far that I know that it occurs when I call IMG_LOAD:

Code:
procedure LoadImage_Back(n: ansistring);
begin
  if fileexists(n) = True then
  begin
    backgroundGraph := IMG_LOAD(PChar(n))
  end
  else
  begin
    Writeln('ERROR: File ' + n + ' not found.');
    Halt;
  end;
end;
I call this procedure to load a background image for the appropriate window size, such as

LoadImage_Back('graphics/bg-1024.png');


Now, very funny it is that I can change this single line to

LoadImage_Back('graphics/bg-800.png');

in order to load the background image that is for 800x600 -- and here the game runs just fine (of course with a mis-sized background, but it runs).


Of course the file 'graphics/bg-1024.png' exists, and it's a simple .png file, as is the other. I then opened the file in the Mac OS preview program and saved it again -- since then everything runs fine, so I assume that either the .png was broken, or SDL_IMAGE for Mac OS has bugs.

No such problems on Windows and Linux. What is happening here?