And if I really wanted to learn something I’d listen to more records. And I do, we do, you do.
—The Hives, “Untutored Youth”
This chapter will cover a few libraries that will make your life easier.
My impression is that C libraries have grown less pedantic over the
years. Ten years ago, the typical library provided the minimal set of tools
necessary for work, and expected you to build convenient and
programmer-friendly versions from those basics. The typical library would
require you to perform all memory allocation, because it’s not the place of
a library to grab memory without asking. Conversely, the libraries presented
in this chapter all provide an “easy” interface, like
curl_easy_... functions for cURL, Sqlite’s single
function to execute all the gory steps of a database transaction, or the
three lines of code we need to set up a mutex via GLib. If they need
intermediate workspaces to get the work done, they just do it. They are fun
I’ll start with somewhat standard and very general libraries, and move on to a few of my favorite libraries for more specific purposes, including SQLite, the GNU Scientific Library, libxml2, and libcURL. I can’t guess what you are using C for, but these are friendly, reliable systems for doing broadly applicable tasks.
Given that the standard library left so much to be filled in, it is only natural that a library would eventually evolve to fill in the gaps. GLib implements enough basic computing needs that it will pass ...