Shared Libraries in Linux

For the last few weeks I was busy programming my DNSNINJA [1] tool. During my tests
I came accross an issue related with shared libraries under Linux. Therefore, I’ve decided to investigate a little bit further on this issue. A good read on the concepts behind shared libraries can be found unter [2], a page from the Linux Documentation Project. If you ever had questions in mind such the ones below, the provided link under [2] might help and bring it home to you:

  • What is that lib name for (libpthread, libpurple)?
  • What is that .so file for?

Three Types of Library Names

There are basically three types of names a library uses:

  • Soname: This is a specially constructed name. The pattern is like “ The version number is a number and does only change, if the library interface changes. A fully-qualified soname includes also the directory it’s in.
  • Real name: This is the real name of your library. This is the file, which actually contains your library code. It is basically the soname plus additional version information. The pattern is like “..”. The last period and the release number are optional though.
  • Linker Name:This is the name that the compiler uses when requesting a library. It is simply the soname without any version number details.

An example: If you’ve written a library named “foobar” and your current release is 1.1, your soname would be “”, whereas your library’s real name would be “”. The linker name is “libfoobar”.

Creating Shared Libraries

If you’re interested in building a shared library, the document under [2] also gives good instructions on doing that. Perhaps, I’ll build a shared library of my own, once in a while. We’ll see 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *