CompiledCodeFunction
is a function created by FunctionCompile that contains compiled code that is run when the CompiledCodeFunction is applied to suitable arguments.
Details
- CompiledCodeFunction objects typically accept only arguments that conform to specified types.
- If nonconforming arguments are provided, CompiledCodeFunction returns a Failure object.
- FunctionCompileExport and related functions can be used to generate code suitable for external use from CompiledCodeFunction[…].
- CompiledCodeFunction objects can include embedded libraries or byte code to optimize loading.
Examples
open allclose allBasic Examples (1)
FunctionCompile creates a CompiledCodeFunction:
The CompiledCodeFunction evaluates with an argument of the correct type:
Information returns information about a CompiledCodeFunction:
Scope (3)
A CompiledCodeFunction contains information about how it was created, which can enable loading from a file. By default, platform-dependent byte code is included:
If a CompiledCodeFunction is written to a file and loaded, a new functioning CompiledCodeFunction is created. If byte code is found that matches the current platform, that will be used:
The restored CompiledCodeFunction works as expected:
Platform-dependent byte code can be created for a range of platforms. This can be used if the CompiledCodeFunction was loaded into a different system:
A shared library can be embedded in the output:
The library will be used when the code function is loaded from a file. This makes loading faster:
The restored CompiledCodeFunction works as expected:
Text
Wolfram Research (2019), CompiledCodeFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/CompiledCodeFunction.html.
CMS
Wolfram Language. 2019. "CompiledCodeFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompiledCodeFunction.html.
APA
Wolfram Language. (2019). CompiledCodeFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompiledCodeFunction.html