Hi all. Im studying Threads. I tried to run some examples but one i didnt get.

This example ok:
Code:
uses	
	SDL;

  {$APPTYPE CONSOLE}
var 	
	thread: PSDL_Thread;
	returnValue: Integer;

function thread_func(): Integer;
begin
	// do threading here
	WriteLn('Start Thread');
	SDL_Delay(5000);
	WriteLn('End Thread');

	result := 1; // thread leaves and return this value
end;

begin
	returnValue := 0;
	thread := SDL_CreateThread(@thread_func, NIL);
	
	SDL_WaitThread(thread, returnValue);
	WriteLn('Thread returns code ',returnValue);

	SDL_Quit;
	WriteLn('ByeBye ;)');
end.
But this, i get error. why? What is wrong? This example I ported from Lazy Foo's tutorial.
Code:
program teste;

{$APPTYPE CONSOLE}

uses
  sdl,
  sdlutils,
  sdl_image;


const
   SCREEN_WIDTH = 640;
   SCREEN_HEIGHT = 480;
   SCREEN_BPP = 32;

var
   screen,image: PSDL_Surface;
   event: TSDL_Event;
   thread: PSDL_Thread;
   quit: boolean = false;



function load_image(filename: string; setcolorkey: boolean) : PSDL_Surface; overload;
var
   optimizedImage, loadedImage: PSDL_Surface;
   r,g,b: uint8;

begin
    loadedImage := IMG_Load(pchar(filename));

    if &#40;loadedImage <> nil&#41; then
    begin
        optimizedImage &#58;= SDL_DisplayFormat&#40;loadedimage&#41;;
        SDL_FreeSurface&#40;loadedimage&#41;;
        if &#40;optimizedImage <nil> 0&#41; do
        begin
            case event.type_ of
               SDL_QUITEV&#58;
                    quit&#58;= true;
            end;
        end;
		clean_up;
    end;

end.
Sorry my english.