adds declarations decls to compiled component "name".
adds the specification spec to the specified field in the compiled component "name".
- Compiled components can be used to represent a named group of compiler declarations.
- Compiled components can be used to represent compiled functionality that can be built into a shared library.
- Compiled components can be embedded in paclets.
- DeclareCompiledComponent["name",...] creates the compiled component "name" if it does not already exist.
- Declarations from compiled components can be added to a compiler environment with CreateCompilerEnvironment and with CompilerEnvironmentAppendTo.
- Declarations from compiled components are used when building installed and library functions.
- A library that contains installed and library functions can be built with BuildCompiledComponent.
- A library that contains installed and library functions can be loaded with LoadCompiledComponent.
- The following values for field can be given:
"Declarations" declarations to use with the component "InstalledFunctions" functions to compile and symbols into which to install the results "LibraryFunctions" functions to compile, to be recovered by LoadCompiledComponent "LoadingEpilogs" functions to be executed after the component is loaded by LoadCompiledComponent "ExternalLibraries" libraries to be loaded before the component is loaded by LoadCompiledComponent
- "Declarations" can be given as a single declaration or a list of declarations.
- "InstalledFunctions" can be given as a rule symfunc that specifies that a compiled version of func will be installed in the symbol sym when the component built is loaded. "InstalledFunctions" can also accept an association of rules.
- "InstalledFunctions" can be given a symbol sym, which will effectively declare the installed function symsym. If sym is the name of a compilable function (including one defined in the component), then it will be compiled and installed into the symbol sym for use outside compiled code. A list of symbols can also be given. »
- "LibraryFunctions" can be given as a rule "name"func that specifies that a compiled version of func will be made available in the result of LoadCompiledComponent under the name "name". "LibraryFunctions" can also be given as an association.
- "LoadingEpilogs" can be given as a single function or a list of functions.
- "ExternalLibraries" can be given as a single library specification or a list of library specifications. Library specifications must be resolvable by FindLibrary.
- The names of "LibraryFunctions" are limited by the format of dynamic libraries.
- The "InstalledFunctions" and "LibraryFunctions" fields contain the source to be compiled. BuildCompiledComponent builds that source and saves the result to a dynamic library. The dynamic library can be loaded with LoadCompiledComponent to recover the results of the compilation.
Examplesopen allclose all
Basic Examples (2)
Use "demo" in a call to FunctionCompile:
DeclareCompiledComponent can give functions to compile into a library:
DeclareCompiledComponent can define symbols to get installed code:
Wolfram Research (2022), DeclareCompiledComponent, Wolfram Language function, https://reference.wolfram.com/language/ref/DeclareCompiledComponent.html.
Wolfram Language. 2022. "DeclareCompiledComponent." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DeclareCompiledComponent.html.
Wolfram Language. (2022). DeclareCompiledComponent. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeclareCompiledComponent.html