User`s guide

Interfacing M-Code to C/C++ Code
5-43
callback that references the specified function. Without this pragma, the -h
option will not be able to locate and compile all M-files used in your application.
If you are using the
%#function pragma to define functions that are not
available in M-code, you must write a dummy M-function that identifies the
number of input and output parameters to the M-file function with the same
name used on the
%#function line. For example,
%#function myfunctionwritteninc
This implies that myfunctionwritteninc is an M-function that will be called
using
feval. The Compiler will look up this function to determine the correct
numberofinputandoutputvariables.Therefore, you needtoprovideadummy
M-function that contains a function line, such as
function y = myfunctionwritteninc( a, b, c );
and includes the %#external pragma. T his statement indicates that the
function takes three inputs (
a, b, c) and returns a single output variable (y).No
other lines need to be present in t he M-function.
Compiling MEX-Files
If the Compiler finds both a function M-file and a .mex file in the same
directory, it will assume that the
.mex file is the compiled version of the M-file.
Inthosecases,if the M-fileversionisnotdesired,use the
%#mex pragmato force
the Compiler to use the MEX-file. For example,
function y = gamma(x)
%#mex
error('gamma MEX-file is missing');