What is the difference between functions like mclmcrInitialize and mclInitial​izeApplica​tion?

4 views (last 30 days)
I have created shared libraries using the MATLAB Compiler. The documentation mentions that the driver application needs to make use of MATLAB Compiler Runtime (MCR) functions like mclmcrInitialize and mclInitializeApplication.
What is the difference between these functions and when should they be used?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Oct 2022
Edited: MathWorks Support Team on 14 Oct 2022
mclmcrInitialize and mclInitializeApplication are MATLAB Compiler Runtime (MCR) functions which are typically used in driver applications for shared libraries.
mclInitializeApplication: This function should be called once at the beginning of your driver application. You must make this call before calling any other MathWorks functions.
mclmcrInitialize: Loads three main libraries (libmex,libmat.libmclmcr) and sets runtime environment for running MATLAB functions.
If the driver application has a main() method, you need to use mclInitializeApplication in the main() method. This in turn calls mclmcrInitialize to load all the libraries.
For example, refer to the following C shared library example:
If the driver application has a main() as well as an additional method which uses the mclRunMain function, you must first call mclmcrInitialize. Then inside the function called from mclRunMain, you can call mclInitializeApplication to complete the MCR initialization procedure. mclRunMain is an additional MCR function which handles platform specific threading issues.
For example, refer to the following C++ shared library example:
In this example, run_main() is the additional method which is called by the mclRunMain function.

More Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Products


Release

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!