title: Hiding symbol visibility while building a shared lib
body: <p>I have multiple objects files (lets say <code>obj1.o</code>, <code>obj2.o</code>) with which i am building a shared library (<code>libapp.so</code>). All associated objects so not had visibility flag as hidden when they were built, but in final so (<code>libapp.so</code>, see below), if i use visibility flag as <code>hidden</code>, will it hide all internal functions from outside libraries to use?</p>
  
  <pre><code>gcc -shared -fPIC -fvisibility=hidden obj1.o obj2.o -o libapp.so
  </code></pre>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>As wRAR mentioned, i tried using versions cript to hide all symbol on final shared library. version script was written like-</p>
  
  <p>file:libapp.version</p>
  
  <pre><code>{
      local: *;
  };
  </code></pre>
  
  <p>and i built my shared library as:</p>
  
  <pre><code>gcc -shared -fPIC obj1.o obj2.o -o libapp.so -Wl,--version-script=libapp.version
  </code></pre>
  
  <p>Even after putting all symbol as local, i still can see in nm that all symbols are present. What i am doing wrong here?</p>