Troubleshooting Calls to C++ Library Functions
This topic describes common issues you might encounter when you call a function in a published MATLAB® interface to a C++ shared library.
Library Interface Does Not Contain Any Instances of Type
To see what classes are available, see the documentation for your library. For library
libname
, type:
doc clib.libname
In some cases, a publisher might create a library interface that does not include classes or other functionality from the original C++ library. For information about how to include missing functionality in the MATLAB interface, see How to Complete Definitions in Library Definition File.
Invalid clib
Array Element Type Name
The MATLAB name for a clib array element type includes clib
and the
library name. For more information, see clibArray
.
For example, for library libname
containing class
MyClass
, the clib array type is:
clib.array.libname.MyClass
and the MATLAB element type is:
clib.libname.MyClass
For fundamental C++ types, use upper camel case for the element type name. For example,
if the C++ type is double
, then the clib array type is:
clib.array.libname.Double
and the MATLAB element type is:
clib.libname.Double
First Letter of Type Must Be Capitalized
When creating a clib array, MATLAB converts the names of fundamental C++ types to upper camel case.
For example, if the C++ type is signed int
, then the MATLAB clib array type for library libname
is:
clib.array.libname.SignedInt
and the element type is:
clib.libname.SignedInt
For strings, if the C++ type is std::string
, then:
clib.array.libname.std.String % clib array type clib.libname.std.String % element type