Reference

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.

getWSLINKset the error handling buffer
processWSLINKsend a message in the Wolfram Language

Callback functions for using WSTP in a library function.

registerLibraryExpressionManagerregister a library expression manager
unregisterLibraryExpressionManagerunregister 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.

MNumericArray_newcreate a new MNumericArray
MNumericArray_freefree an MNumericArray
MNumericArray_disownallow a shared MNumericArray to be freed
MNumericArray_disownAllallow all shared MNumericArrays to be freed
MNumericArray_clonecopy an MNumericArray
MNumericArray_shareCountget the number of shared references to MNumericArrays

Callback functions for creating and freeing an MNumericArray.

MNumericArray_getRankget the rank of an MNumericArray
MNumericArray_getDimensionsget the dimensions of an MNumericArray
MNumericArray_getFlattenedLengthget the number of elements of an MNumericArray
MNumericArray_getTypeget the type of an MNumericArray

Callback functions for getting structural information from an MNumericArray.

MNumericArray_getDataget the data from an MNumericArray

Callback function for getting elements from an MNumericArray.

MNumericArray_convertTypeconverts the data type of an MNumericArray

Callback function for converting the type of an MNumericArray.

MImage_new2Dcreate a new 2D MImage
MImage_new3Dcreate a new 3D MImage
MImage_freefree an MImage
MImage_disownallow a shared MImage to be freed
MImage_disownAllallow all shared MImages to be freed
MImage_clonecopy an MImage
MImage_shareCountget the number of shared references to MImages

Callback functions for creating and freeing an MImage.

MImage_getDataTypeget the data type of an MImage
MImage_getRowCountget the number of rows of an MImage
MImage_getColumnCountget the number of columns of an MImage
MImage_getSliceCountget the number of slices of an MImage
MImage_getRankget the rank of an MImage
MImage_getChannelsget the number of channels of an MImage
MImage_alphaChannelQtest if an MImage has an alpha channel
MImage_interleavedQtest if pixels in an MImage are stored in an interleaved manner
MImage_getColorSpaceget the color space of an MImage
MImage_getFlattenedLengthget the number of elements of an MImage

Callback functions for getting structural information from an MImage.

MImage_getBitget an element from an MImage of type "Bit"
MImage_getByteget an element from an MImage of type "Byte"
MImage_getBit16get an element from an MImage of type "Bit16"
MImage_getReal32get an element from an MImage of type "Real32"
MImage_getRealget an element from an MImage of type "Real64"
MImage_getRawDataget the data of a an MImage
MImage_getBitDataget the data of a "Bit" MImage
MImage_getByteDataget the data of a "Byte" MImage
MImage_getBit16Dataget the data of a "Bit16" MImage
MImage_getReal32Dataget the data of a "Real32" MImage
MImage_getRealDataget the data of a "Real64" MImage

Callback functions for getting elements from an MImage.

MImage_setBitset an element in an MImage of type "Bit"
MImage_setByteset an element in an MImage of type "Byte"
MImage_setBit16set an element in an MImage of type "Bit16"
MImage_setReal32set an element in an MImage of type "Real32"
MImage_setRealset an element in an MImage of type "Real64"

Callback functions for setting elements in an MImage.

MImage_convertTypeconverts the data type of an MImage

Callback function for converting the type of an MImage.