LoadCompiledComponent[comp]
loads a compiled component comp.
LoadCompiledComponent[comp,target]
loads a compiled component comp from the target location.
LoadCompiledComponent
LoadCompiledComponent[comp]
loads a compiled component comp.
LoadCompiledComponent[comp,target]
loads a compiled component comp from the target location.
Details
- 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.
- comp can be given as a CompiledComponent object or a string with the name of a compiled component.
- Typically, loading a compiled component involves loading a shared library created with BuildCompiledComponent.
- If no target location is given, then FindLibrary is used to find a library with the same name as the target component.
- The "ExternalLibraries" setting of DeclareCompiledComponent gives external libraries that are loaded before the component library is loaded.
- The "LoadingEpilogs" setting of DeclareCompiledComponent gives functions to be executed after the component library is loaded.
- Calling an installed function from an unloaded component will attempt to automatically load the component, failing if no build exists.
- The following option can be given:
-
CompilerEnvironment Automatic a compiler environment, which by default includes the declarations in the component, passed to functions set by "LoadingEpilogs"
Examples
open all close allBasic Examples (1)
DeclareCompiledComponent["demoComp", "LibraryFunctions" -> <|
"square" -> Function[{Typed[arg, "Real64"]}, arg ^ 2]
|>];BuildCompiledComponent["demoComp"]res = LoadCompiledComponent["demoComp"]Call the function included in the built component:
res["LibraryFunctions"]["square"][10.5]Scope (1)
Declare a list of declarations in a component:
DeclareCompiledComponent["fullComponent", {
FunctionDeclaration[return12, Typed[{} -> "MachineInteger"]@Function[{}, 12]],
FunctionDeclaration[addtwo, Typed[{"MachineInteger"} -> "MachineInteger"]@Function[x, x + 2]]
}];DeclareCompiledComponent["fullComponent", "LibraryFunctions" -> <|
"libFunc" -> Function[Typed[arg, "Real64"], Sqrt[arg]]
|>];Declare an installed function:
DeclareCompiledComponent["fullComponent", "InstalledFunctions" -> addtwo];BuildCompiledComponent["fullComponent"]Use an installed function to automatically load the build:
addtwo[3]Explicitly load the component to access the built library function:
LoadCompiledComponent["fullComponent"]Tech Notes
Related Guides
History
Text
Wolfram Research (2022), LoadCompiledComponent, Wolfram Language function, https://reference.wolfram.com/language/ref/LoadCompiledComponent.html.
CMS
Wolfram Language. 2022. "LoadCompiledComponent." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LoadCompiledComponent.html.
APA
Wolfram Language. (2022). LoadCompiledComponent. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LoadCompiledComponent.html
BibTeX
@misc{reference.wolfram_2026_loadcompiledcomponent, author="Wolfram Research", title="{LoadCompiledComponent}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/LoadCompiledComponent.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_loadcompiledcomponent, organization={Wolfram Research}, title={LoadCompiledComponent}, year={2022}, url={https://reference.wolfram.com/language/ref/LoadCompiledComponent.html}, note=[Accessed: 12-June-2026]}