Reputation: 65
In the 1.2 version of the SDL libraries, I cant find the .c or .cpp files.
I know that I can download it from the SDL website, but I'm guessing, How does SDL work just with the header files, it doesn't need the source files for read the definitions of the functions?
Upvotes: 0
Views: 904
Reputation: 129374
That's probably becasue you are looking at the library (binary) distribution, rather than the source code. The first section here:
http://www.libsdl.org/download-1.2.php
is the source code (as a tar.gz, rpm and zip file archive), followed by various variants of the binary distributions.
There are definitely a lot of .cc (another name for C++ source) files in the source repository.
In a binary distribution, there are just the files you need to use or develop with the library, which means in the former case DLL's or .so files that can be installed on the machine, and in the second case, header files, .lib or .a files, which allow you to compile code that uses the library. It is common practice to distribute code as binary packages, as there is often little or no need for most people to compile the library in the first place - assuming of course there aren't too many bugs in the library, etc.
The applications built to use SDL are linked to the libraries in the developer package, and uses the .DLL or .SO files in the runtime distribution (typically also included in the developer distribution to make it "one download instead of two"). This is exactly the same as you don't (normally) have the source code for printf
or cout
in the distribution for the C or C++ runtime library that comes with the compiler.
Upvotes: 2