When you build a MEX-file, MATLAB® dynamically-links your code with the following libraries:
MATLAB runtime libraries, libmex.dll and libmx.dll. To avoid compatibility issues, run the MEX-file with the same version of MATLAB that was used to create the MEX-file. For more information, see Version Compatibility.
Language-specific libraries, provided by the compiler. C-language MEX-files built on Windows® systems require Visual C++® runtime libraries.
Other runtime libraries, which you specify in the build command.
Dynamic linking means that when you call the function, the program looks for these dependent libraries. The code for these libraries is not included in the MEX-file. When you share a MEX-file with another MATLAB user, these libraries must be present on the user's computer.