slouken@465: slouken@465: slouken@465: slouken@465: Building SDL with Borland's C++ compilers slouken@642: slouken@465: slouken@465: slouken@465: slouken@642: slouken@465:

Building SDL with Borland's C++ compilers.

slouken@642: by David Snopek slouken@642: and updated by Dominique slouken@642: Louis ( Last updated : 30th June 2003 ).
slouken@642:
slouken@642: These instructions cover how to compile SDL and its included test slouken@642: programs using either Borland C++ Builder 5, 6 for Windows, slouken@642: C++ Builder for Linux ( AKA Kylix 3 ) or the free Borland C++ command-line compiler.
slouken@642: slouken@465:

Extract the files

slouken@642: slouken@465:

Unzip the Borland.zip archive into this directory. Do not unzip slouken@642: it into any other directory because the makefiles ( *.mak ) and project slouken@642: files ( *.bpr ) use relative paths to refer to the SDL sources. This should slouken@642: create a directory named "Borland" inside of the top level SDL source directory. slouken@642:

slouken@642: slouken@465:

Using Borland C++ Builder 5, 6 for Windows slouken@465:

slouken@642: slouken@465:

Inside of the "Borland" directory there is a "bcb6" directory that contains slouken@642: a number of Builder project files. Double-click on the "libSDL.bpg" file slouken@642: icon. Once Builder has started click on the "Projects" menu on slouken@642: the menu-bar and go down to "Build All Projects" option.
slouken@642: This will proceed to build SDL ( with Borland's calling convention ), slouken@642: SDLmain, and all the test programs. Currently, all slouken@642: the test programs are dynamically linked to Sam Lantinga's slouken@642: SDL.dll.

slouken@642: slouken@465:

NOTE : Borland's "lib" format and Microsoft's "lib" format are incompatible. slouken@465:  
slouken@642: If you wish to dynamically link to the SDL library supplied by Sam Lantinga slouken@642: in each release, I have created the correct *.libs for SDL 1.2.4 and they slouken@642: exist in the "/lib" directory.
slouken@642: If you would like to create the *.lib files yourself, you will need to slouken@642: make use of Borland's "implib.exe" utility.
slouken@642:

slouken@642: slouken@465:

IMPLIB works like this:

slouken@642: slouken@465:
    IMPLIB (destination lib name) (source dll)
slouken@642: slouken@465:

For example,

slouken@642: slouken@465:
    IMPLIB SDL.lib SDL.dll
slouken@642: slouken@465:

This assumes that SDL.dll was compiled with Visual C++ or similar.
slouken@642:

slouken@642: slouken@465:

To learn more about the difference between Borland's and Microsoft's *.lib slouken@642: format please read the article here.
slouken@642:

slouken@642: slouken@465:


slouken@642: NOTE :
The C++ Builder for Windows project format, is not compatible slouken@642: with the Kylix 3 project format, hence the reason why they are in separate slouken@642: directories.

slouken@642: slouken@465:

Using the free Borland C++ command-line compiler slouken@642:

slouken@642: slouken@465:

The free Borland compiler can be downloaded at no charge from the Borland website slouken@642: . Make sure that it is installed and properly configured.

slouken@642: slouken@465:

Open an MS-DOS Prompt. Change to the "Borland\freebcc" directory under slouken@642: the SDL source directory. Type "make -f SDL.mak" to build SDL and "make slouken@642: -f SDLmain.mak". There are also makefiles for all of the test programs, if you wish to build them. All .exes and slouken@642: DLLs are created in the "test" SDL directory. Ify ou would like to create slouken@642: the DLL and all the test applications, I have thrown together a basic batchfile slouken@642: called "makeall.bat" which should create everything in the right order.

slouken@642: slouken@465:

Output files

slouken@642: No matter which compiler you used, three important files should have slouken@642: been produced: slouken@465: slouken@642: Both of the *.lib files will need to be added to all the projects slouken@642: that use SDL and SDL.dll must be placed some where the Windows dynamic slouken@642: linker can find it (either in your project directory or on the system slouken@642: path, C:\WINDOWS\SYSTEM). slouken@465:

Using Borland C++ Builder for Linux ( AKA Kylix slouken@642: 3 )

slouken@642: slouken@465:

Inside of the "Borland" directory there is a "k3" directory that contains slouken@642: a number of Builder project files. Double-click on the "libSDL.bpg" file slouken@642: icon. Once Builder has started click on the "Projects" menu on slouken@642: the menu-bar and go down to "Build All Projects" option. This will slouken@642: proceed to build all the test programs
slouken@642: Linux users do not need *.lib files as the Shared Object is linked right slouken@642: into the project ( very neat actually, Windows should do this sort of thing slouken@642: as it is a lot easier for the developer ).
slouken@642: NOTE : The C++ Builder for Windows project format, is not slouken@642: compatible with the Kylix 3 project format, hence the reason why they are slouken@642: in separate directories.

slouken@642: slouken@465:

On Mandrake 8.1 the shared objects for SDL are located in the /usr/lib slouken@642: directory as libSDL_*.so and the Mesa OpenGL shared objects are located slouken@642: in /usr/X11R6/lib as libGL*.so
slouken@642:
slouken@642: So if your setup is different you may need to change the project file slouken@642: so that they re-link to the ones on your system.
slouken@642:
slouken@642: On Mandrake 8.1 the headers files are located at /usr/include/SDL/. slouken@642: So if you you have not installed the development RPMs ( usually named libSDL-devel* slouken@642: ) for SDL ( not included ) you may have to change the include directory slouken@642: within some of the projects.
slouken@642:

slouken@642: slouken@642:

Known Problems

slouken@642: The only known problem is that I ( Dominique Louis ), was unable to slouken@642: create the projects that rebuilt the SDL shared objects under Linux, due slouken@642: to time constraints and my lack of intimate knowledge of Linux. slouken@642:

Test programs

slouken@642: Some of the test programs require included media files ( *.wav; *.bmp slouken@642: etc ). All the test programs are now created in the "test" directory, where slouken@642: the media files are ( usually ) so they should be ready to go.
slouken@465:
slouken@642:
slouken@642:
slouken@465: slouken@465: