C/C++ Language Interface

The Wolfram Language supports several levels of interfacing to C and C++ programs. You can call functions from C-compatible libraries directly from Wolfram Language. You can compile Wolfram Language code that calls C-compatible libraries into native machine code. You can create "installable" C programs where C functions are directly connected to Wolfram Language functions. You can use C to call the Wolfram Language through the Wolfram Symbolic Transfer Protocol (WSTP) and get full access to its capabilities. And you can create C program fragments and modify C source code.

Foreign Function Interface »

ForeignFunctionLoad load a function from a C-compatible dynamic library

ForeignFunction a function that calls into a C-compatible dynamic library

RawMemoryAllocate  ▪  RawMemoryRead  ▪  RawMemoryWrite  ▪  RawMemoryImport  ▪  RawMemoryExport  ▪  RawPointer  ▪  ...

Wolfram Compiler »

FunctionCompile create a compiled version of a function

FunctionCompileExportLibrary create a shared library by compiling a function

FunctionDeclaration an auxiliary function declaration to use in compilation

LibraryFunctionDeclaration an auxiliary declaration of a library function to use in compilation

FunctionCompileExport  ▪  FunctionCompileExportString  ▪  FunctionCompileExportByteArray  ▪  CreateCompilerEnvironment  ▪  ...

Calling C Programs from the Wolfram Language »

Install load an installable WSTP program

.tm template file for connecting C and Wolfram Language functions

mcc, mprep scripts for building WSTP programs

WSEvaluate() call back into the Wolfram Language

Calling the Wolfram Language from C Programs »

WSPutInteger32()  ▪  WSGetInteger32()  ▪  WSPutString()  ▪  WSPutFunction()  ▪  ...

WSOpenString()  ▪  WSNextPacket()  ▪  WSReady()  ▪  ...

Wolfram LibraryLink »

LibraryFunctionLoad load a function from a dynamic library into the Wolfram System

LibraryFunction a function that calls into a dynamic library

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

Calling C Compilers from the Wolfram Language »

CreateExecutable create an executable from C code

CreateLibrary create a library from C code

Generating C Code »

Export export a Wolfram Language compiled function into C code

CCodeGenerate export a Wolfram Language compiled function into C code

CCodeStringGenerate  ▪  SymbolicCGenerate  ▪  LibraryGenerate

CForm convert an expression to C language form

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