FunctionCompile
FunctionCompile[func]
generates a compiled code function from a Wolfram Language function.
Details and Options

- The function func is typically specified as a Function pure function. The variables in the Function object are typically annotated with Typed.
- FunctionCompile[func] produces a CompiledCodeFunction object that can be applied to suitable arguments just like func.
- Inside func, KernelFunction can be used to indicate functions that should directly use the Wolfram Engine rather than being compiled into low-level code.
- The code in the CompiledCodeFunction object can be output for external purposes using FunctionCompileExport and related functions.
- FunctionCompile has the option CompilerOptions, which allows detailed options to be passed to different parts of the compilation pipeline.
Examples
open all close allBasic Examples (1)
Compile a Function into a compiled code function:
The CompiledCodeFunction evaluates with an argument of the correct type:
If unexpected arguments are given, an error results:
Many common operations are supported in compiled code:
Information can extract the signature of the CompiledCodeFunction:
Scope (9)
Possible Issues (3)
Neat Examples (1)
Introduced in 2019
(12.0)