WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center
Wolfram Language Home Page »

LibraryFunctionLoad

LibraryFunctionLoad [lib,fun,argtype,rettype]

loads Wolfram Library lib and makes the library function fun available in the Wolfram Language.

Details and Options

  • Arguments of LibraryFunctionLoad are:
  • lib library to be loaded
    fun function name as specified in the library file
    argtypes list of argument types
    rettype return type
  • Possible argument and return types, and their corresponding C type, include:
  • True |False mbool Boolean
    _Integer mint machine integer
    _Real double machine double
    _Complex mcomplex machine complex double
    {dt,r} MTensor tensor with element data type dt and rank r
    LibraryDataType [SparseArray ,dt,r] MSparseArray sparse array with element data type dt and rank r
    LibraryDataType [Image ,it] MImage image with ImageType it
    LibraryDataType [Image3D ,it] MImage 3D image with ImageType it
    "UTF8String" char* string in UTF-8 encoding
    LinkObject WSLINK arguments and result passed over WSTP
    "Void" void no result (return only)
  • LibraryFunctionLoad returns the LibraryFunction object.
  • LibraryFunctionLoad can be called more than once with the same arguments returning the same LibraryFunction object.
  • LibraryFunctionLoad uses FindLibrary to locate libraries found on $LibraryPath .
  • When a Wolfram Library is loaded, an initialization function in the library is called.
  • When a Wolfram Library is unloaded, an uninitialization function in the library is called.
  • Libraries loaded by LibraryFunctionLoad run in the same process as the Wolfram Language kernel.
  • Functions in libraries loaded by LibraryFunctionLoad can make callbacks to the Wolfram Language.
  • Libraries loaded by LibraryFunctionLoad can share data with the Wolfram Language kernel.
  • LibraryFunctionUnload unloads a LibraryFunction so that it can no longer be used.
  • Libraries loaded by LibraryFunctionLoad are unloaded when the Wolfram Language kernel exits.
  • Libraries loaded by LibraryFunctionLoad must be written as a dynamic library for the platform on which they run.

Examples

open allclose all

Basic Examples  (3)

Load a function from a sample library:

Call the function:

You can call LibraryFunctionLoad more than once for the same input:

Load a function from the library, which will exchange data over WSTP:

Load a function, which calls back to the Wolfram Language to evaluate Message [MyFunction::info]:

Possible Issues  (1)

LibraryFunctionLoad uses FindLibrary to locate libraries:

It is faster to find the library once with FindLibrary :

See Also

LibraryFunction   LibraryFunctionUnload   FindLibrary   Function   Compile   CompiledFunction   Install   $LibraryError

Tech Notes

History

Introduced in 2010 (8.0) | Updated in 2014 (10.0)

Wolfram Research (2010), LibraryFunctionLoad, Wolfram Language function, https://reference.wolfram.com/language/ref/LibraryFunctionLoad.html (updated 2014).

Text

Wolfram Research (2010), LibraryFunctionLoad, Wolfram Language function, https://reference.wolfram.com/language/ref/LibraryFunctionLoad.html (updated 2014).

CMS

Wolfram Language. 2010. "LibraryFunctionLoad." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/LibraryFunctionLoad.html.

APA

Wolfram Language. (2010). LibraryFunctionLoad. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LibraryFunctionLoad.html

BibTeX

@misc{reference.wolfram_2025_libraryfunctionload, author="Wolfram Research", title="{LibraryFunctionLoad}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/LibraryFunctionLoad.html}", note=[Accessed: 22-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_libraryfunctionload, organization={Wolfram Research}, title={LibraryFunctionLoad}, year={2014}, url={https://reference.wolfram.com/language/ref/LibraryFunctionLoad.html}, note=[Accessed: 22-April-2025 ]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /