CompilationTarget
Details

- CompilationTarget applies to the creation of the compiled function.
- The following settings can be used:
-
"WVM" the Wolfram Virtual Machine "C" C code - CompilationTarget -> "WVM" creates code for the traditional Wolfram System virtual machine.
- CompilationTarget -> "C" creates C code, which is compiled to an external machine code library and linked back into the Wolfram Language.
- External files created when a "C" target is specified are deleted either after use or when the Wolfram System exits.
- A suitable external C compiler is required to target C code. If one is not found, the Wolfram System will use the "WVM".
- When either "C" or "WVM" targets are specified, the following additional settings can be used:
-
RuntimeAttributes -> Listable compile a function with Listable attribute Parallelization -> True try using multiple threads if possible
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
You can target C code generation from Compile:

https://wolfram.com/xid/04z8qdup2d6j1yie-c9ym1h

This runs the compilation using C code:

https://wolfram.com/xid/04z8qdup2d6j1yie-gkbxet

C code generation runs faster:

https://wolfram.com/xid/04z8qdup2d6j1yie-d6blo1

The default operation using the WVM runs more slowly:

https://wolfram.com/xid/04z8qdup2d6j1yie-e8pv6d

You can combine parallel operations with C code generation to get even faster operation:

https://wolfram.com/xid/04z8qdup2d6j1yie-ga9ju1

Neat Examples (1)Surprising or curious use cases
A real-time plotting of the Mandelbrot set, the computation using a CompilationTarget of C and parallelism is fast enough to update the image in real time.
First, the compiled function to compute values:

https://wolfram.com/xid/04z8qdup2d6j1yie-befc1d
Now, a plot viewer to display the result and handle the interactions:

https://wolfram.com/xid/04z8qdup2d6j1yie-je7ul7
Now you can invoke the functions. Note that this is an image to interact with the picture you need to evaluate the commands:

https://wolfram.com/xid/04z8qdup2d6j1yie-gk4uwn

Wolfram Research (2010), CompilationTarget, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilationTarget.html.
Text
Wolfram Research (2010), CompilationTarget, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilationTarget.html.
Wolfram Research (2010), CompilationTarget, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilationTarget.html.
CMS
Wolfram Language. 2010. "CompilationTarget." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompilationTarget.html.
Wolfram Language. 2010. "CompilationTarget." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompilationTarget.html.
APA
Wolfram Language. (2010). CompilationTarget. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompilationTarget.html
Wolfram Language. (2010). CompilationTarget. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompilationTarget.html
BibTeX
@misc{reference.wolfram_2025_compilationtarget, author="Wolfram Research", title="{CompilationTarget}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/CompilationTarget.html}", note=[Accessed: 08-July-2025
]}
BibLaTeX
@online{reference.wolfram_2025_compilationtarget, organization={Wolfram Research}, title={CompilationTarget}, year={2010}, url={https://reference.wolfram.com/language/ref/CompilationTarget.html}, note=[Accessed: 08-July-2025
]}