title: How do applications resolve to different versions of shared libraries at run time?
body: <p>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.</p>
  
  <p>As far as I understand, a shared library has three "names", for example,</p>
  
  <ol>
  <li>libmy.so.1.2 (real-name i.e. the actual obj file)</li>
  <li>libmy.so.1   (SONAME, which is embedded in the actual obj file)</li>
  <li>libmy.so     (linker name, provided to the linker at link time and embedded in executable)</li>
  </ol>
  
  <p>When you install the library via LDCONFIG, it will create the following symbolic links</p>
  
  <ul>
  <li>(2) => (1)</li>
  <li>(3) => (2)</li>
  </ul>
  
  <p>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 </p>
  
  <p>At application link time what is the linker name that I would provide with the "-l" flag. Following the guidelines I read (<a href="http://www.dwheeler.com/program-library/Program-Library-HOWTO/x36.html" rel="noreferrer">http://www.dwheeler.com/program-library/Program-Library-HOWTO/x36.htm</a>l), wouldn't it have to be libmy.so and if so, how will both versions of the obj file be distinguished ?</p>