#include <Matlab.h>
Static Public Member Functions | |
static void | Initialize () |
static void | InitializeApplication (const char **options, int count) |
static Matlab & | Instance () |
Get static singleton object. | |
Interface to MATLAB Compiler Runtime (MCR)
The static Matlab::Initialize or Matlab::InitializeApplication functions should be called before any code that either makes use of the MCR C++ functions or code generated by the MATLAB Compiler, respectively. Only the first invocation of these functions will execute the MCR initialization code. This is to ensure that the MCR was initialized. Usually this initialization should take place at the begin of the main function already, after the parsing of the command-line options.
Code that makes use of the MATLAB C++ types and functions should include the MCR proxy header file instead of the C++ header files shipped with MATLAB itself. This guarantees that users only need an installation of the free MCR to execute the code. Note that mclmcrrt.h is included by mirtkMatlab.h and that it is recommended to include mirtkMatlab.h instead.
|
static |
Load MATLAT Compiler Runtime libraries and set environment
Loads three main libraries (libmex, libmat, libmclmcr) and sets runtime environment for running MATLAB functions.
Use InitializeApplication to initialize a standalone MCR application, which will also call mclmcrInitialize. This function may be used if mclInitializeApplication is not required, e.g., when only using some of MATLAB's C++ types and functions such as to read/write a MAT file. If code generated from .m files using the MATLAB Compiler is called, use InitializeApplication instead. If the MCR application uses a mclRunMain function, however, call Initialize first in the main function and then InitializeApplication in the mclRunMain function.
This static function can be called at any time by the main thread before the execution of any MATLAB Compiler generated code. It will only initialize the MCR upon the first invocation.
|
static |
Initialize MATLAB Compiler Runtime
This function must be called before any of the code generated from .m files using the MATLAB Compiler is executed. It calls the MCR function mclInitializeApplication which implicitly loads the MCR libraries, and throws an error if this function failed.
The MCR application is terminated automatically by the destructor of the static singleton object, i.e., mclTerminateApplication must not be called explicitly by the user.
This static function can be called at any time by the main thread before the execution of any MATLAB Compiler generated code. It will only initialize the MCR upon the first invocation.