Main Content

Troubleshooting MATLAB Interface to C++ Library Run-Time Issues

A library interface is a dynamically linked module that the MATLAB® interpreter loads and executes when you call a function in the library. Dynamic linking means that when you call the function, the program looks for dependent libraries. The library might use specialized run-time libraries which are not built into the MATLAB interface. The code for these libraries is not included in the interface; the libraries must be present on your computer when you call the library.

Library Interface Does Not Exist or Is Not Loaded

MATLAB searches for the library interface file on the MATLAB path. The interface file for library libname is libnameInterface.ext, where ext is the platform-specific file extension for a shared library file.

Missing or Incorrectly Installed Run-Time Libraries

The library publisher should provide information about installing dependent libraries. To find library dependencies:

  • On Windows® systems, download the Dependency Walker utility from the website https://www.dependencywalker.com.

  • For Visual Studio® users, call:

    dumpbin /dependents libname.dll
  • On Linux® systems, use:

    ldd -d libname.so
  • On macOS systems, use:

    otool -L libname.dylib

MATLAB Terminates Unexpectedly When Calling C++ Library Function

If you build the library in debug mode, it might be incompatible with MATLAB, causing an access violation and the program to terminate or crash. On Windows, to ensure that a debug build uses the same C/C++ run-time library as MATLAB, see Resolve Incompatible Debug Build for C++ Library on Windows.

MATLAB Interface to C++ Library Compatibility

An interface file that was published with an earlier version of MATLAB usually runs on later versions of MATLAB. If the interface generates errors, republish the interface with the current MATLAB release.

Running an interface published with a newer version of MATLAB on an older version of MATLAB is not supported.

See Also

Topics