C COMPILER DRIVER PACKAGE TUTORIAL
The CCompilerDriver package lets you work with C compilers that are installed on your computer. It lets you build executables, libraries, and object files from C source code. It is called automatically by the Mathematica compiler when you set the option CompilationTarget to "C". It is also useful for building MathLink executables as well as Wolfram Libraries (dynamic linking libraries that can be linked into Mathematica).
To use the package it must first be loaded.
This is a sample source file for a Wolfram Library.
This creates a library and returns the full path.
If you do not have any suitable C compiler, the compilation will fail and a message will be generated.
This library was written as a Wolfram Library, so you can load functions from it using LibraryFunctionLoad.
This calls the LibraryFunction.
In addition to building libraries, the CCompilerDriver package lets you build executables and object files.
Does Mathematica Include a C Compiler?
Mathematica does not ship with a C compiler. If you want to take advantage of the CCompilerDriver package, you will have to make sure that you have an installed C compiler on your computer. Many computers either ship with a C compiler or can add one as an optional extra. In addition, you can find other compilers from various commercial and non-commercial sources.
You can learn about the C compilers that are supported in the section on specific compilers.