Using MEX-Files

Binary MEX-files are subroutines produced from C/C++ or Fortran source code. They behave just like MATLAB® scripts and built-in functions. While scripts have a platform-independent extension .m, MATLAB identifies MEX-files by platform-specific extensions. The following table lists the platform-specific extensions for MEX-files.

MEX-File Platform-Dependent Extension

PlatformBinary MEX-File Extension

Linux® (64-bit)


Apple Mac (64-bit)


Microsoft® Windows® (32-bit)


Windows (64-bit)


You cannot use a binary MEX-file on a platform if you compiled it on a different platform. Recompile the source code on the platform for which you want to use the MEX-file.For information about using MEX S-functions, see your Simulink® documentation.

Was this topic helpful?