Wolfram LibraryLink allows dynamic libraries to be directly loaded into the Wolfram Language kernel so that functions in the libraries can be immediately called from the Wolfram Language. You can exchange not only C-like data types such as integers, reals, packed arrays, and strings, but also arbitrary Wolfram Language expressions. In addition, there are useful functions such as sending errors and calling back to the Wolfram Language.

This section summarizes the functionality.

Wolfram Language Functions

This section summarizes the functions used to interact with Wolfram Libraries from the Wolfram Language.

LibraryFunctionLoadload a function from a library
LibraryFunctionrepresentation of a handle to a function loaded from a library
LibraryFunctionUnloadunload a function that was previously loaded from a library
LibraryUnloadunload all functions previously loaded from a library

Wolfram Language functions for loading and unloading functions from Wolfram Libraries.

LibraryFunctionInformationreturns information about a LibraryFunction

Wolfram Language function for getting information about a function loaded from a Wolfram Library.

$LibraryPaththe path used to find libraries
FindLibraryfind a library on the library path

Wolfram Language functions for locating Wolfram Libraries.

LibraryLoadload a library without calling any functions

Wolfram Language function for loading a library to resolve dependencies.

CreateManagedLibraryExpressioncreate an expression that may be associated with library data
ManagedLibraryExpressionQtest if an expression is a managed library expression
ManagedLibraryExpressionIDgive the positive integer ID associated with a managed library expression

Wolfram Language functions for managed library expressions.

$LibraryErrorsystem-dependent errors from loading libraries
LibraryVersionInformationrules containing information about the version of a library
LibraryVersionStringa string of library version information

Wolfram Language functions in the LibraryLink` package.

Library Callback Functions

This section summarizes C language callback functions used to implement libraries.

MTensor_newcreate a new MTensor
MTensor_freefree an MTensor
MTensor_disownallow a shared MTensor to be freed
MTensor_disownAllallow all shared MTensors to be freed
MTensor_clonecopy an MTensor

Callback functions for creating and freeing an MTensor.

MTensor_getRankget the rank of an MTensor
MTensor_getDimensionsget the dimensions of an MTensor
MTensor_getFlattenedLengthget the number of elements of an MTensor
MTensor_getTypeget the type of an MTensor

Callback functions for getting structural information from an MTensor.

MTensor_getIntegerget an element from an MTensor of integers
MTensor_getRealget an element from an MTensor of reals
MTensor_getComplexget an element from an MTensor of complex numbers
MTensor_getMTensorget an MTensor sub-part from an MTensor
MTensor_getIntegerDataget the data of an integer MTensor
MTensor_getRealDataget the data of a real MTensor
MTensor_getComplexDataget the data of a complex MTensor

Callback functions for getting elements from an MTensor.

MTensor_setIntegerset an element in an MTensor of integers
MTensor_setRealset an element in an MTensor of reals
MTensor_setComplexset an element in an MTensor of complex numbers
MTensor_setMTensorset an MTensor subpart in an MTensor

Callback functions for setting elements in an MTensor.

Messagesend a message in the Wolfram Language
AbortQcheck if an abort is in progress

Callback functions for handling errors in library functions.

UTF8String_disowncalled when a string argument is no longer used

Callback functions for working with strings.

getWolframLinkset the error handling buffer
processWolframLinksend a message in the Wolfram Language

Callback functions for using WolframLink in a library function.

registerLibraryExpressionManagerregister a library expression manager
unregisterLibraryFunctionManagerunregister a library expression manager
releaseManagedLibraryExpressionrelease a managed library expression

Callback functions for managed library expressions.

registerLibraryCallbackManagerregister a library callback manager
unregisterLibraryCallbackManagerunregister a library callback manager
callLibraryCallbackFunctioncall a connected library callback function
releaseLibraryCallbackFunctionrelease a library callback function

Callback functions for library callback functions.

MSparseArray_fromExplicitPositionscreate a new MSparseArray from specified positions and values
MSparseArray_fromMTensorcreate a new MSparseArray from an MTensor
MSparseArray_clonecopy an MSparseArray
MSparseArray_freefree an MSparseArray
MSparseArray_disownallow a shared MSparseArray to be freed
MSparseArray_disownAllallow all shared MSparseArrays to be freed

Callback functions for creating and freeing an MSparseArray.

MSparseArray_getRankget the rank of an MSparseArray
MSparseArray_getDimensionsget the dimensions of an MSparseArray
MSparseArray_getExplicitPositionsget the positions with explicit values from an MSparseArray
MSparseArray_getColumnIndicesget the column indices from an MSparseArray
MSparseArray_getRowPointersget the row pointer array from an MSparseArray

Callback functions for getting structural information from an MSparseArray.

MSparseArray_getExplicitValuesget the values corresponding to the explicitly specified positions from an MSparseArray
MSparseArray_getImplicitValueget the value used for positions not explicitly specified from an MSparseArray

Callback functions for getting values from an MSparseArray.

MSparseArray_toMTensorconvert from an MSparseArray to an ordinary MTensor
MSparseArray_resetImplicitValuereset the implicit value and recompute which positions are explicitly stored in an MSparseArray

Callback functions for converting MSparseArrays.

  • Wolfram LibraryLink
  • Systems Interfaces & Deployment
  • Calling External Programs
  • External Operations
  • C/C++ Language Interface
  • Wolfram LibraryLink User Guide
  • Introduction
  • Library Structure
  • Interaction with the Wolfram Language
  • Examples
  • Translate this page: