User`s guide
Internal Interface Functions
5-13
/* ------------- Output Argument Processing ----------- */
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
mlfF Interface Function
The Compiler always generates the mlfF interface function, which contains the
“normal” C interface to the function. This code is the corresponding C interface
function (
mlfGasket) from the Sierpinski Gasket example. This function calls
the C
mgasket function:
/*
* The function "mlfGasket" contains the normal interface
* for the "gasket" M-function from file
* "<matlab>\extern\examples\compiler\gasket.m" (lines 1-23).
* This function processes any input arguments and passes
* them to the implementation version of the function,
* appearing above.
*/
mxArray * mlfGasket(mxArray * numPoints) {
int nargout = 1;
/* ------------- Input Argument Processing ------------ */
mxArray * theImage = NULL;
mlfEnterNewContext(0, 1, numPoints);
/* ----------------- Call M-Function ------------------ */
theImage = Mgasket(nargout, numPoints);
/* ------------- Output Argument Processing ----------- */
mlfRestorePreviousContext(0, 1, numPoints);
return mlfReturnValue(theImage);
}
mlfNF Interface Function
The Compiler produces this interface function only when the M-function uses
the variable
nargout.The nargout interface allows you to specify the number
of requested outputs via the
int nargout argument, as opposed to the normal
interface that dynamically calculates the number of outputs based on the
number of non-NULL inputs it receives.