|Load C/C++ shared library into MATLAB|
|Unload shared library from memory|
|Determine if shared library is loaded|
|Call function in shared library|
|Return information on functions in shared library|
|Display shared library function signatures in window|
|Pointer object compatible with C pointer|
MATLAB includes a sample external library called
stringToUpper function in the
shrlibsample library converts the characters in the input argument to uppercase.
shrlibsample example library contains two functions with
c_struct structure input parameters.
This example shows how to display information about and modify a libstruct object,
readEnum function in the
library displays a string that matches the input argument.
multDoubleRef function in the
shrlibsample library multiplies the input by
print2darray function in the
shrlibsample library displays the values of a 2-D array with three columns and a variable number of rows.
This example shows how to create a MATLAB® cell array of character vectors,
mlStringArray, from the output of the
How to call functions in external, shared libraries from MATLAB software.
How to construct MATLAB arguments compatible with the argument types found in the library functions.
When you pass a MATLAB structure to an external library function:
Many functions in external libraries pass arguments by reference.
MATLAB provides a way to modify header file information by creating a prototype file, a file of MATLAB commands.
The MATLAB shared library interface supports C library routines only.
MATLAB returns pointers to structures.
Errors occur when the shared library is not a valid library.
This error occurs when you call a function without the correct input or output arguments, or if there is an error in the function signature in the header file.
Some shared libraries, compiled as Microsoft® Windows® 32-bit libraries, use a calling convention that is incompatible with the default MATLAB calling convention.