User`s guide
Internal Interface Functions
5-11
Internal Interface Functions
This section uses the Sierpinski Gasket example (gasket.m) to s how several of
the generated interface functions for the C and C++ cases. The remaining
interface functions are generated by the example
foo.m as described earlier in
this chapter.
Interface functions perform argument translation between the standard
calling conve ntions and the Compiler-generat ed code.
C Interface Functions
The C interface functions process any input arguments a nd pass them to the
implementation version of the function,
Mf.
mlx
F
Interface Function
The Com p ile r always generate s 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{:});
wouldusethe 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[]) {