title: How does gcc `-shared` option affect the output?
body: <p>Technically, in terms of file content, what is the difference between the output of <code>gcc -fPIC -shared src.c</code> and <code>gcc -fPIC src.c</code>?</p>
  
  <p>Assume that <code>int main(int, char**)</code> is defined in <code>src.c</code> so that both compilations succeed. But executing the <code>a.out</code> generated by <code>gcc -shared src.c</code>, as expected, gave the following error:</p>
  
  <p><code>-bash: ./a_shared.out: cannot execute binary file</code></p>
  
  <p>Even if there is a <code>main</code> function it it.</p>
  
  <p>Also, how can I inspect the difference in the output files using tools like <code>otool</code> or <code>objdump</code>?</p>
  
  <p>Thanks a lot.</p>