title: Linking to shared object with a version number (libexample.so.1) and the gcc "-l:" option
body: <p>I am having trouble dynamically linking my program to OpenAL on gnu/linux.</p>
  
  <p>The command <code>sudo ldconfig -p | grep openal</code> prints:</p>
  
  <blockquote>
    <p>libopenal.so.1 (libc6) => /usr/lib/i386-linux-gnu/libopenal.so.1</p>
  </blockquote>
  
  <p>The command I initially used to link was <code>gcc test.o -lopenal</code> but that didn't work. The error message I get is:</p>
  
  <blockquote>
    <p>/usr/bin/ld: cannot find -lopenal</p>
  </blockquote>
  
  <p>After searching the web a long time I found a solution that works (note the colon after -l):</p>
  
  <blockquote>
    <p>gcc test.o -l:libopenal.so.1</p>
  </blockquote>
  
  <p>The solution works but I cannot seem to find any documentation on the special link option used.</p>
  
  <p>My question is what the best way to link to a shared object with a version suffix (like <code>libopenal.so.1</code>) is.<br>
  It would also be good to know what the <code>-l:libname.so</code> option does, so if someone can explain it and/or point me to some documentation about it I would be very glad.</p>