This is documentation for Mathematica 9, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

C/C++ Language Interface

Mathematica supports several levels of interfacing to C and C++ programs. You can create "installable" C programs where C functions are directly connected to Mathematica functions. You can use C to call Mathematica through MathLink and get full access to its capabilities. And you can create C program fragments and modify C source code.


Calling C Programs from Mathematica »

Install load an installable MathLink program

.tm template file for connecting C and Mathematica functions

mcc, mprep scripts for building MathLink programs

MLEvaluate() call back into Mathematica

Calling Mathematica from C Programs »

MLPutInteger32() ▪ MLGetInteger32() ▪ MLPutString() ▪ MLPutFunction() ▪ ...

MLOpenString() ▪ MLNextPacket() ▪ MLReady() ▪ ...

Wolfram LibraryLink »

LibraryFunctionLoad load a function from a dynamic library into Mathematica

LibraryFunction a function that calls into a dynamic library

LibraryFunctionInformation ▪ LibraryFunctionUnload ▪ LibraryLoad ▪ LibraryUnload ▪ FindLibrary ▪ $LibraryPath ▪ ...

Calling C Compilers from Mathematica »

CreateExecutable create an executable from C code

CreateLibrary create a library from C code

Generating C Code »

Export export a Mathematica compiled function into C code

CCodeGenerate export a Mathematica compiled function into C code

CCodeStringGenerate ▪ SymbolicCGenerate ▪ LibraryGenerate

CForm convert an expression to C language form

Splice splice Mathematica output into C source files

Symbolic Representation of C Code »

CFunction symbolic representation of a C function

CCall symbolic representation of a C function call

CAddress ▪ CAssign ▪ CBlock ▪ CDeclare ▪ CIf ▪ CPointerType ▪ CStruct