C: Difference between revisions
imported>Mic92 add article about the c infrastructure |
imported>Mic92 typos |
||
Line 17: | Line 17: | ||
== The compiler wrapper == | == The compiler wrapper == | ||
When | When inspecting the compiler or linker executable one will notice that those are not binaries but shell scripts: | ||
binaries but shell scripts: | |||
<syntaxHighlight lang=console> | <syntaxHighlight lang=console> | ||
Line 30: | Line 29: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
These shell-scripts | These shell-scripts wrap around the actual compiler and add additional compiler flags depending | ||
on environment variables. In particular the wrapper around the | on environment variables. In particular the wrapper around the C compiler, | ||
will also look for a <code>NIX_CFLAGS_COMPILE</code> variable and prepend the content | will also look for a <code>NIX_CFLAGS_COMPILE</code> variable and prepend the content | ||
to command line arguments passed to the underlying compiler. | to command line arguments passed to the underlying compiler. | ||
Line 54: | Line 53: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
In <code>$NIX_CFLAGS_COMPILE</code> we see that the include search path by appending new directories | In <code>$NIX_CFLAGS_COMPILE</code> we see that the include search path is extended by appending new directories | ||
using the <code>-isystem</code flag. For <code>$NIX_LDFLAGS</code> see that the library link path is extended | using the <code>-isystem</code flag. For <code>$NIX_LDFLAGS</code> see that the library link path is extended | ||
using the <code>-L</code> flag. We also notice that in addition to library paths the linker gets instructed | using the <code>-L</code> flag. We also notice that in addition to library paths the linker gets instructed |