Invalid MEX File Errors
If MATLAB® cannot find all
.dll files referenced by a MEX file, it
cannot load the MEX file. MATLAB displays the following error message:
Invalid MEX-file mexfilename: The specified module could not be found.
mexfilename is the module with the dependency error. This
module cannot find its dependent libraries. To resolve this error, find the names of the
dependent libraries, and determine if they are present on your system and on the system
path. To find library dependencies:
On Windows® systems, download the Dependency Walker utility from the website https://www.dependencywalker.com.
On Linux® systems, use:
ldd -d libname.so
On macOS systems, use:
otool -L libname.dylib
.dll files that the MEX file linked against when it was built,
.dll files must be on the system path or in the same folder as
the MEX file.
MEX files might require additional libraries that are not linked to the MEX file. Failure to find one of these explicitly loaded libraries might not prevent a MEX file from loading, but prevents it from working correctly. The code that loads the libraries controls the search path used to find these libraries. The search path might not include the folder that contains the MEX file. Consult the library documentation on proper installation locations.
Possible reasons for failure include:
MATLAB version incompatibility. For more information, see MEX Version Compatibility.
Missing compiler run-time libraries. If your system does not have the same compiler that built the MEX file, see the Microsoft® MSDN® website for information about Visual C++® Redistributable Packages.
Missing or incorrectly installed specialized run-time libraries. Contact your MEX file or library vendor.