loadlibrary
Load C shared library into MATLAB
Syntax
Description
loadlibrary(
loads functions from C shared library libname
,hfile
)libname
defined
in header file hfile
into MATLAB®. The loadlibrary
function only supports
calling functions that are callable from C and header files that can be
parsed by a C compiler. Functions written in C++ must be declared as
extern "C"
. Alternatively, to call functions in C++
libraries, see Call C++ from MATLAB.
loadlibrary(
loads the library if the name of the header file is the same as the name of
the library file.libname
)
loadlibrary(
loads the library with one or more libname
,hfile
,Name,Value
)Name,Value
arguments.
loadlibrary(
uses a prototype
file, libname
,@protofile
)protofile
, in place of a header
file.
Examples
Input Arguments
Output Arguments
Limitations
You must have a supported C compiler and Perl must be available.
Do not call
loadlibrary
if the library is already in memory. To test this condition, calllibisloaded
.loadlibrary
does not support libraries generated by the MATLAB Compiler SDK™ and code generation products like MATLAB Coder.The MATLAB Shared Library interface does not support library functions with function pointer inputs.
For more information, see Limitations to Shared Library Support.
More About
Tips
If you have more than one library file of the same name, load the first using the library file name. Then load the additional libraries using the
alias
option.Use the
alias
option as an alternate name for a library. To load an alternate header file, use the @protofile
argument.
Version History
Introduced before R2006a