FunctionCompileExportLibrary
FunctionCompileExportLibrary [file,fspec]
exports a compiled version of function specification fspec as a shared library suitable for external use.
FunctionCompileExportLibrary [file,defs,fspec]
uses the auxiliary definitions defs for compilation.
Details and Options
- FunctionCompileExportLibrary generates a library suitable for use on the type of computer on which it is run.
- 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.
- The following library types are generated on different types of systems:
-
Macintosh .dylibWindows .dllLinux .so
- The following option can be given:
- By default, FunctionCompileExportLibrary creates a library in the current directory given by Directory [].
- FunctionCompileExportLibrary has the option CompilerOptions , which allows detailed options to be passed to different parts of the compilation pipeline.
- The library generated by FunctionCompileExportLibrary is suitable for linking into external programs. It can also be loaded into the Wolfram System using LibraryFunctionLoad .
Examples
open allclose allBasic Examples (4)
Export a compiled version of a function into a library:
Load the library and create a CompiledCodeFunction :
Execute the function in the CompiledCodeFunction :
The file can be an absolute path:
Several functions can be compiled with FunctionCompileExportLibrary :
Loading the library creates a list of compiled code functions:
Execute the code that was loaded:
Several functions can be compiled with FunctionCompileExportLibrary :
Loading the library creates a list of compiled code functions:
Execute the code that was loaded:
Auxiliary definitions can be given with FunctionDeclaration :
Load and execute code in the library:
Options (2)
CompilerEnvironment (1)
Create a compiler environment and add a function definition:
Use a compiler environment in a compilation:
Loading the library creates a CompiledCodeFunction :
Execute the code that was loaded:
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.
Possible Issues (1)
Destination Problems (1)
If an output path is chosen that does not exist or for which there is no permission, an error occurs:
Text
Wolfram Research (2019), FunctionCompileExportLibrary, Wolfram Language function, https://reference.wolfram.com/language/ref/FunctionCompileExportLibrary.html (updated 2021).
CMS
Wolfram Language. 2019. "FunctionCompileExportLibrary." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/FunctionCompileExportLibrary.html.
APA
Wolfram Language. (2019). FunctionCompileExportLibrary. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FunctionCompileExportLibrary.html
BibTeX
@misc{reference.wolfram_2025_functioncompileexportlibrary, author="Wolfram Research", title="{FunctionCompileExportLibrary}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/FunctionCompileExportLibrary.html}", note=[Accessed: 22-April-2025 ]}
BibLaTeX
@online{reference.wolfram_2025_functioncompileexportlibrary, organization={Wolfram Research}, title={FunctionCompileExportLibrary}, year={2021}, url={https://reference.wolfram.com/language/ref/FunctionCompileExportLibrary.html}, note=[Accessed: 22-April-2025 ]}