4928

Integrated C Workflow

Basica idea: Start a C compiler from/with Mathematica, compile the code, and link it with Mathematica.
Other applications:

  • Use an external C compiler in Mathematica instead of the internal Mathematica compiler
  • Integrate C code in Mathematica and use it as normal Mathematica functions
  • Integrate C code in Mathematica and parallelize it with Mathematica
  • Generate standalone C code from Mathematica

Create Executable Files

Create Executable Files

Executables can be created from many different C compilers running on different architectures. You can do that by using the following Mathematica Code.

Needs["CCompilerDriver`"]
CreateExecutable["
#include

int main(){
printf(\"hello world\\n\");
}
", "hello"]