Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mclRunMain

Mechanism for creating identical wrapper code across all platforms

Synopsis

typedef int (*mclMainFcnType)(int, const char **);

int mclRunMain(mclMainFcnType run_main,
               int argc,
               const char **argv)

Description

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 mclRunMain if your application brings up its own full graphical environment.

Note

In non-Macintosh environments, mclRunMain acts as a wrapper and doesn’t perform any significant processing.

Parameters

run_main

Name of function to execute after MATLAB Runtime set-up code.

argc

Number of arguments being passed to run_main function. Usually, argc is received by application at its main function.

argv

Pointer to an array of character pointers. Usually, argv is received by application at its main function.

Examples

Call using this basic structure:

int returncode = 0;
mclInitializeApplication(NULL,0); 
returncode = mclRunMain((mclmainFcn)
                   my_main_function,0,NULL);

Introduced in R2010b

Was this topic helpful?