title: C kernel library includes and bloat
body: <p>I am new, so I appreciate your help and patience in advance. I have written a program in C like this:</p>
  
  <pre><code>main.c
  arpsend.h - header w/include guard for arpsend.c functions
  arpsend.c - includes &lt;net/if.h&gt;, &lt;pthread.h&gt;, etc.
  arprec.h  - header w/include guard for arprec.c functions
  arprec.c  - includes &lt;net/if.h&gt;, &lt;pthread.h&gt;, etc.
  </code></pre>
  
  <p>The arpsend and arprec files use many of the same kernel library functions and definitions. I have noticed that my program size shot up when I wrote the arprec.c code. It bloated much more than what my code should have. This leads me to conclude that both the arpsend.c and the arprec.c linked the linux library code necessary for their own needs in their respective .c files. The linking is redundant for the project, but necessary for each .c file.</p>
  
  <p>My questions are the following: </p>
  
  <ol>
  <li><p>if every .c file I add to a project will bloat like this because of kernel and standard library redundancies, wouldn't every program become needlessly bloated? The bloat in my example is probably insignificant (~12k), but I can only imagine the kind of bloat that would happen if I needed to use some graphics library across several different .c files. </p></li>
  <li><p>Is there a way to avoid this? </p></li>
  <li><p>Is the recommended solution to simply keep all functions using the same kernel code in one file? </p></li>
  <li><p>If #3 is correct, doesn't that defeat the point of trying to keep clean code? It's C, so it's not really OOP, but I would like to spread my code out so that I can easily see the makeup of a project.</p></li>
  </ol>
  
  <p>I apologize if this is redundant. I sifted through the forums here for a couple hours. I couldn't find my exact question. Thanks again for your help</p>