User`s guide

Internal Interface Functions
5-11
Internal Interface Functions
This section uses the Sierpinski Gasket example (gasket.m) to show 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 conventions and the Compiler-generated code.
C Interface Functions
The C interface functions process any input arguments and pass them to the
implementation version of the function,
Mf.
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.
Note Comments have been added to the generated code to highlight where
the input and output arguments are processed and where functions are called.
/*
* 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.