Sometimes you need to pass additional options to the C compiler for compiling or linking a library.
For calling some C functions, you need to link with a specific
OS-level library that contains that function. E.g., the sin
function requires linking a special library by using the command line
switch -lm. In our C interface you do the equivalent thing by
calling add-lib as follows:
c-library math s" m" add-lib \c #include <math.h> c-function sin sin r -- r end-c-library
The add-lib call adds the -lm to the linker command
line, such that the library libm.so (or somesuch) is linked
with the new library; you can add as many as you need. Finally you
declare the function as shown above. All words inside the
c-library...end-c-library can use functions from this
library (or these libraries).
Add -lstring to the linker call for the current
library, where string is represented by c-addr u.
I.e., link with libstring.so or somesuch.
Add -Lstring to the linker call for the current
library, where string is represented by c-addr u.
I.e., add string to the directories that are searched for
C libraries specified with add-lib.
Add -framework string (see Darwin Options in Using the GNU Compiler Collection) to the compiler call for
the current library, where string is represented by
c-addr u.
Add -Istring to the compiler call for the current
library, where string is represented by c-addr u.
I.e., add string to the directory where the C compiler
searches for .h files.
Add the string c-addr u to the currently used flags for C compilation.
Add the string c-addr u to the currently used flags for C linking.