title: Selective Static Linking Of Library Functions In Shared Library
body: <p>I want to create a shared library that uses functions from a 3rd-party static library. For example, <code>foo</code> and <code>bar</code> from <code>libfoobar.a</code>. I know that my main application is also using <code>foo</code> and will be exporting that symbol. So I simply want to link in <code>bar</code> to save code size and leave 'foo' unresolved (as it will be provided by main application). If I include <code>libfoobar.a</code>, the linker <em>ld</em> will include both functions in my shared library. If I don't include <code>libfoobar.a</code>, my library will not have access to function <code>bar</code> because the application itself is not linking in <code>bar</code>. Questions:</p>
  
  <ul>
  <li>Is there a way to tell <em>ld</em> to only resolve certain symbols when building the shared library?</li>
  <li>Turn <code>libfoobar.a</code> into a shared library?</li>
  <li>Extract file containing function <code>bar</code> from <code>libfoobar.a</code> and specify that on the linker line?</li>
  <li>Don't worry about it, the run-time loader will use <code>bar</code> from your application so the copy of <code>bar</code> in the shared library will not be loaded? </li>
  </ul>