({{, (RefLink[FunctionCompileExportString, paclet:ref/FunctionCompileExportString])[func] 
gives a string of textual LLVM code obtained by compiling the function func.}, {, (RefLink[FunctionCompileExportString, paclet:ref/FunctionCompileExportString])[func,"format"]
gives a string of textual code in the specified format.}})

OpenersNotesSection(Spacer1)Details and Options

Possible values for "format" include:

The following options can be given:

With the setting (RefLink[TargetSystem, paclet:ref/TargetSystem])->(RefLink[Automatic, paclet:ref/Automatic]), (RefLink[FunctionCompileExportString, paclet:ref/FunctionCompileExportString]) will generate code for the machine architecture on which it is being run, including, for example, taking account of word length.

In (RefLink[FunctionCompileExportString, paclet:ref/FunctionCompileExportString])[func,…], func can be a (RefLink[CompiledCodeFunction, paclet:ref/CompiledCodeFunction]) object.

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Generate a compiled version of a function and return the resulting LLVM IR as a string:

FunctionCompileExportString[Function[Typed[arg,"MachineInteger"],arg+1]]

The export format can be given explicitly:

FunctionCompileExportString[Function[Typed[arg,"MachineInteger"],arg+1], "Assembler"]

OpenersExampleSection1(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)TargetSystem  (1)

The default setting of (RefLink[Automatic, paclet:ref/Automatic]) generates code for the machine architecture on which it is being run:

FunctionCompileExportString[Function[Typed[arg,"MachineInteger"],arg+1]]

(RefLink[TargetSystem, paclet:ref/TargetSystem]) can be set to the (RefLink[$SystemID, paclet:ref/$SystemID]) of the desired platform:

FunctionCompileExportString[Function[Typed[arg,"MachineInteger"],arg+1],TargetSystem->"Linux-ARM"]

(RefLink[TargetSystem, paclet:ref/TargetSystem]) can be combined with different format settings:

FunctionCompileExportString[Function[Typed[arg,"MachineInteger"],arg+1],"Assembler",TargetSystem->"Linux-ARM"]

(RefLink[TargetSystem, paclet:ref/TargetSystem]) can be set for architectures for which the Wolfram Engine does not exist:

FunctionCompileExportString[Function[Typed[arg,"MachineInteger"],arg+1],"Assembler",TargetSystem->"WebAssembly"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FunctionCompile, paclet:ref/FunctionCompile])  ▪  (RefLink[FunctionCompileExport, paclet:ref/FunctionCompileExport])  ▪  (RefLink[FunctionCompileExportByteArray, paclet:ref/FunctionCompileExportByteArray])  ▪  (RefLink[FunctionCompileExportLibrary, paclet:ref/FunctionCompileExportLibrary])  ▪  (RefLink[TargetSystem, paclet:ref/TargetSystem])  ▪  (RefLink[ExportString, paclet:ref/ExportString])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Code Compilation, paclet:guide/CodeCompilation])}})}})