Main Content

Understand the mclmcrrt Proxy Layer

All application and software components generated by MATLAB® Compiler™ and MATLAB Compiler SDK™ need to link against only one MATLAB library, mclmcrrt. This library provides a proxy API for all the public functions in MATLAB libraries used for matrix operations, MAT-file access, utility and memory management, and application MATLAB Runtime. The mclmcrrt library lies between deployed MATLAB code and these other version-dependent libraries, providing the following functionality:

  • Ensures that multiple versions of the MATLAB Runtime can coexist

  • Provides a layer of indirection

  • Ensures applications are thread-safe

  • Loads the dependent (re-exported) libraries dynamically

The relationship between mclmcrrt and other MATLAB libraries is shown in the following figure.

The MCLMCRRT Proxy Layer

The MCLMCRRT library layer is statically linked to the MX and MAT modules and sits above the MCLMCR and MCR libraries

In the figure, solid arrows designate static linking and dotted arrows designate dynamic linking. The figure illustrates how the mclmcrrt library layer sits above the mclmcr and mcr libraries. The mclmcr library contains the run-time functionality of the deployed MATLAB code. The mcr module ensures each bundle of deployed MATLAB code runs in its own context at run time. The mclmcrrt proxy layer, in addition to loading the mclmcr, also dynamically loads the MX and MAT modules, primarily for mxArray manipulation. For more information, see the MathWorks® Support database and search for information on the MSVC shared library.

Caution

Deployed applications must only link to the mclmcrrt proxy layer library (mclmcrrt.lib on Windows®, mclmcrrt.so on Linux®, and mclmcrrt.dylib on Macintosh). Do not link to the other libraries shown in the figure, such as mclmcr, libmx, and so on.