Load and Unload C Shared Library
Note
To use C or C++ libraries with MATLAB® R2022a or later, see Call C++ from MATLAB. For more information, see Load C++ Library In-Process or Out-of-Process.
To give MATLAB access to functions in a C shared library, first load the library into memory. After you load the library, you can request information about library functions and call them directly from the MATLAB command line.
To load a shared library into MATLAB, use the loadlibrary
function. The most common syntax
is:
loadlibrary('shrlib','hfile')
where shrlib
is the shared library file name, and
hfile
is the name of the header file containing the
function signatures or prototypes.
When you are finished working with the shared library, it is important to unload the library to free memory.
See Also
clibConfiguration
| loadlibrary
| unloadlibrary