Mechanism for creating identical wrapper code across all platforms
typedef int (*mclMainFcnType)(int, const char **); int mclRunMain(mclMainFcnType run_main, int argc, const char **argv)
|
Name of function to execute after MATLAB® Runtime set-up code. |
|
Number of arguments being passed to |
|
Pointer to an array of character pointers. Usually, |
As you need to provide wrapper code when creating an application
which uses a C or C++ shared library created by MATLAB Compiler SDK™, mclRunMain
enables
you with a mechanism for creating identical wrapper code across all MATLAB Compiler SDK platform
environments.
mclRunMain
is especially helpful in Macintosh OS X environments
where a run loop must be created for correct MATLAB Runtime operation.
When a Mac OS X run loop is started, if mclInitializeApplication
specifies
the -nojvm
or -nodisplay
option,
creating a run loop is a straight-forward process. Otherwise, you
must create a Cocoa framework. The Cocoa frameworks consist of libraries,
APIs, and MATLAB Runtime that form the development layer for all
of Mac OS X.
Generally, the function pointed to by run_main
returns
with a pointer (return value) to the code that invoked it. When using
Cocoa on the Macintosh, however, when the function pointed to
by run_main
returns, the MATLAB Runtime calls
exit before the return value can be received by the application, due
to the inability of the underlying code to get control when Cocoa
is shut down.
Caution
You should not use |
Note:
In non-Macintosh environments, |
Call using this basic structure:
int returncode = 0; mclInitializeApplication(NULL,0); returncode = mclRunMain((mclmainFcn) my_main_function,0,NULL);