title: Two ways of linking to static libraries
body: <p>Here are a couple of ways to use functions from a static library, built with <strong>ar</strong> (i.e. <code>libSOMTEHING.a</code>):</p>
  <pre><code>ld -o result myapp.o  -Lpath/to/library -lname 
  ld -o result myapp.o  path/to/library/libname.a 
  </code></pre>
  <p>Since we omit any dynamic libraries from the command line, this should build a static executable.</p>
  <p>What are the differences? For example, are the whole libraries linked in the executable, or just the needed functions? In the second example, does switching the places of the lib and the object file matter?</p>
  <p>(PS: some non-GNU <code>ld</code> linkers require all options like <code>-o</code> to be before the first non-option filename, in which case they'd only accept <code>-L... -lname</code> before <code>myapp.o</code>)</p>