FunctionCompileExportByteArray
FunctionCompileExportByteArray[fspec]
gives a byte array of binary LLVM code obtained by compiling the function specification fspec.
FunctionCompileExportByteArray[defs,fspec]
uses the auxiliary definitions defs for compilation.
FunctionCompileExportByteArray[fspec,"format"]
gives a byte array of binary code in the specified format.
Details and Options
- Functions can be given as a Function pure function, a list of pure functions or an association of pure functions.
- Auxiliary definitions can be given with FunctionDeclaration or by giving a CompilerEnvironment option.
- Possible values for "format" include:
-
"LLVMBinary" LLVM binary code "Binary" machine code for a specific architecture - The following options can be given:
-
CompilerEnvironment Automatic an environment of definitions for compilation CompilerOptions CompilerOptions detailed options for the compilation pipeline ProgressReporting Automatic how to report progress during the compilation TargetSystem Automatic $SystemID for the target architecture - With the setting TargetSystem->Automatic, FunctionCompileExportByteArray will generate code for the machine architecture on which it is being run, including, for example, taking account of word length.
- In FunctionCompileExportByteArray[func,…], func can be a CompiledCodeFunction object.
Examples
open allclose allBasic Examples (3)
Generate a compiled version of a function and return the result as a byte array:
Several functions can be compiled with FunctionCompileExportByteArray:
It can be useful to use an association to hold the functions:
Auxiliary definitions can be given with FunctionDeclaration:
Options (3)
CompilerEnvironment (1)
ProgressReporting (1)
Progress during a compilation is reported:
This can be suppressed by setting the option ProgressReporting to False.
The default value of ProgressReporting is Automatic, which means that the global setting $ProgressReporting is used. If this is set to False, then no progress reporting takes place.
TargetSystem (1)
The default setting of Automatic generates code for the machine architecture on which it is being run:
TargetSystem can be set to the $SystemID of the desired platform:
Text
Wolfram Research (2019), FunctionCompileExportByteArray, Wolfram Language function, https://reference.wolfram.com/language/ref/FunctionCompileExportByteArray.html (updated 2021).
CMS
Wolfram Language. 2019. "FunctionCompileExportByteArray." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/FunctionCompileExportByteArray.html.
APA
Wolfram Language. (2019). FunctionCompileExportByteArray. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FunctionCompileExportByteArray.html