Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're talking about a third party library, some advantages for them are: no need to release source code, (potentially) simpler installation for end developers... although sometimes it turns out to be <em>more</em> of a hassle, especially if it hasn't been done right (linking in other open source projects without fixing up symbols, wrong architectures supported).</p> <p>If you mean just your own code - seems like you're just creating headaches for yourself. If the files aren't changing, they're going to be compiled on disk already (.o), and the compiler won't need to rebuild them unless you do a clean/rebuild all. So you likely won't gain compilation speed.</p> <p>Either way - yes, the output should be the same. A statically linked library is just a collection of the same .o files you would have been linking to directly.</p> <p>EDIT:</p> <p>Specifically addressing speed of .o vs .a - .a is simply a collection of .o files for ease of packaging during development. Once linked in, the result is identical. I just did a quick sanity test to verify: </p> <pre><code>$ cat a.c #include &lt;stdio.h&gt; extern char *something(); int main() { printf("%s", something()); return 0; } $ cat b.c char *something() { return "something fancy here\n"; } $ gcc -c -o a.o a.c $ gcc -c -o b.o b.c $ gcc -o foo1 a.o b.o $ ar -r b.a b.o ar: creating archive b.a $ gcc -o foo2 a.o b.a $ cmp foo1 foo2 </code></pre> <p>And there you have it, identical binaries by linking .o vs .a.</p> <p>There is a slight performance <em>hit</em> if you use dynamic libraries instead of static libraries (I believe only when symbols are looked up). Perhaps this is what the other developer was referring to, that static libraries would be slightly faster than dynamic libraries.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload