Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1108019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:01:10+00:00 2026-05-17T02:01:10+00:00

I’m a noob to how shared libraries work on linux. I am trying to

  • 0

I’m a noob to how shared libraries work on linux. I am trying to understand how do applications resolve different revisions of the same shared library at run-time on linux.

As far as I understand, a shared library has three “names”, for example,

  1. libmy.so.1.2 (real-name i.e. the actual obj file)
  2. libmy.so.1 (SONAME, which is embedded in the actual obj file)
  3. libmy.so (linker name, provided to the linker at link time and embedded in executable)

When you install the library via LDCONFIG, it will create the following symbolic links

  • (2) => (1)
  • (3) => (2)

Now lets say I compile another version of the same library with the following real-name,
libmy.so.2.0. The SONAME by guidelines would be libmy.so.2.0

At application link time what is the linker name that I would provide with the “-l” flag. Following the guidelines I read (http://www.dwheeler.com/program-library/Program-Library-HOWTO/x36.html), wouldn’t it have to be libmy.so and if so, how will both versions of the obj file be distinguished ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:01:11+00:00Added an answer on May 17, 2026 at 2:01 am

    When you create a shared object, you give it both a real name and an SONAME (shared object name). These are used to install the shared object (which creates both the object and various links to it).

    So you can end up with the situation:

    pax> ls -al xyz*
    lrwxrwxrwx  1 pax pax      0  Nov 18 2009  xyz.so -> xyz.so.1
    lrwxrwxrwx  1 pax pax      0  Nov 18 2009  xyz.so.1 -> xyz.so.1.5
    -rw-r--r--  1 pax pax  12345  Nov 18 2009  xyz.so.1.5
    

    with xyz.so.1.5 possessing the SONAME of xyz.so.1.

    When the linker links with xyz.so, it follows the file links all the way to xyz.so.1.5 and uses its SONAME of xyz.so.1 to store in the executable produced, so it can later bind when running.

    Then, when you run the executable, it tries to load using the SONAME that was stored in the executable, xyz.so.1, and this will point to a specific xyz.so.1.N (1.5 at the moment but subject to later change, 1.6 .. 1.N).

    So you could install xyz.so.1.6 and update the xyz.so.1 link to point to it instead and already-linked executables would use that instead (when they run).

    The advantage of this multi-layer method is that you can have multiple potentially incompatible libraries of the same name (xyz.so.1.*, xyz.so.2.*) but, within each major version, you can freely upgrade them since they’re supposed to be compatible.

    When you link to make new executables:

    • Those linking with xyz.so will get the latest minor version of the latest major version.
    • Others linking with xyz.so.1 will get the latest minor version of a specific major version.
    • Still others linking with xyz.so.1.2 will get a specific minor version of a specific major version.

    Now keep that last paragraph in mind as we examine your comment:

    Now lets say I compile another version of the same library with the following real-name, libmy.so.2.0. The SONAME by guidelines would be libmy.so.2.0.

    No, I don’t believe so. The SONAME would be more likely to be libmy.so.2 so that you can make minor updates to the 2.x stream and get the latest behaviour.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.