User`s guide
5 Controlling Code Generation
5-16
C++ Interface Functions
The C++ interface functions process any input arguments and pass them to the
implementation version of the function.
Note In C++, the mlxF interface functions are also C functions in order to
allow the feval interface to be uniform between C and C++.
mlxF Interface Function
The Compiler always generates the mlxF interface function, which is used by
feval. At times, the Compiler needs to use feval to perform argument
matching even if the user does not specifically call
feval. For example,
x = cell(1,5);
y = {1 2 3 4 5};
[x{:}] = deal(y{:});
would use the feval interface. The following C++ code is the corresponding
feval interface (mlxGasket) from the Sierpinski Gasket example. This function
calls the C++
Mgasket function:
//
// The function "mlxGasket" contains the feval interface
// for the "gasket" M-function from file
// "<matlab>\extern\examples\compiler\gasket.m" (lines 1-23).
// The feval function calls the implementation version of
// gasket through this function. This function processes
// any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void mlxGasket(int nlhs,
mxArray * plhs[],
int nrhs,
mxArray * prhs[]) {
MW_BEGIN_MLX();
{
// ------------- Input Argument Processing ---------------
mwArray mprhs[1];
mwArray mplhs[1];