Chapter 1: Introduction, installation and configuration (SDL4FP)

This is an SDL 1.2 chapter. SDL 1.2 is obsolete since it has been replaced by SDL 2.0. Unless you have good reasons to stay here you may prefer to go for the modern SDL 2.0 :-).

The introduction is short. SDL library gives you the ability to program powerful applications for many different operating systems (OS) only by learning one set of commands. The SDL library takes on the assignment to translate your commands to the specific OS commands. It’s especially meaningful to use the SDL library if you plan to develop games or similar software.

Now this Chapter concerns on the installation of all necessary software on your system for programming SDL applications with Freepascal under Windows XP (probably this will work for other windows systems as well; please report if you tried out).

First of all, we have to consider which software is needed. We need three different software packages. We need the Freepascal compiler of course. Furthermore we need the SDL library files and finally we need something what translates our pascal programs to the SDL library (written in C/C++). This will be taken on by a few units.

1) Download the latest stable Freepascal compiler (Version 2.0.0). You
get it here:
2) Download the latest version of SDL4Freepascal (Version You
get it here:
3) Download the latest version of SDL runtime library (Version 1.2.8). You
get it here: (German readers may prefer:

Of course, if you have installed Freepascal already you haven’t to download it again and you can skip step 4.

4) Execute “fpc-2.0.0.i386-win32.exe” to install Freepascal. Let the self-installer create a shortcut on your desktop.
5) Extract “” to get the SDL runtime library. This leads to two extracted files. There is a text file and the very important SDL.dll.
6) Copy those files (especially the SDL.dll!) to your
system32-folder! Usually you find it at “C:\WINDOWS\system32\”.
Don’t confuse it with the similar system-folder. (This works for
WinXP, probably for NT-series and Win2000 as well; if you use Win9x
or WinME you should copy it to system-folder instead of system32-folder)

If it for any reason isn’t possible to copy the files into this folder you later have to have that file into the same folder where the application is. Now you have installed Freepascal and the SDL runtime library on your system. Finally SDL4Freepascal have to be installed.

7) Extract “SDL4Freepascal-” to get the units and some demo programs. There should be about 20 files and a folder “demos” which contains five more files.
8) Open the folder where you have installed Freepascal (e.g. C:\FPC\)
9) Open the folder “units” (e.g. C:\FPC\units\)
10) Create a new folder called “sdl” (e.g. C:\FPC\units\sdl\)
11) Copy the whole former extracted files (including the folder “demos”) from SDL4Freepascal into the sdl-Folder.

Now the compiler has to be told about where to find the new units.

12) Open the Freepascal IDE (for example by clicking the shortcut on desktop).
13) In the menue choose the following item “Options”. From “Options” choose “Directories…”. Now a window should pop up.
14) The last row is called “Unit directories”. There you should write in the full path to your SDL-units (e.g. C:\FPC\units\sdl). Leave the last backslash out.

Congratulations! You have configured your system for developing SDL applications with Freepascal! Now let’s check if it really was that easy…

15) Open the file “demo02.pp” in demos-folder (e.g. C:\FPC\units\sdl\demos\). Run it.

If you see some cool colourful red and blue lines you have done everything as it has to be done :)! Have fun with your configured system!

For those of you who try running the demo and get an abortion together with a messege saying “exitcode = 309”: You skipped step 6! Did you copy the SDL.dll to your system32- or system-folder respectively? If so and the error still occurs you should copy the SDL.dll into the folder where the demos are placed. Now it should work.

[Downloads transferred from old website]

SDL4Freepascal-; OUTDATED: SDL4Free Pascal Version (most recent)

Leave a Reply