User`s guide

3 Writing S-Functions As C-MEX files
3-120
If your S-function has a nonempty mdlUpdate, then update it to this form:
#define MDL_UPDATE
static void mdlUpdate(SimStruct *S, int_T tid)
{
}
otherwise, delete the function.
If your S-function has a nonempty
mdlDerivatives, then update it to this
form:
#define MDL_DERIVATIVES
static void mdlDerivatives(SimStruct *S, int_T tid)
{
}
otherwise, delete the function.
Replace all obsolete SimStruct macros. See Table 3-13 for a complete list of
obsolete macros.
When converting level 1 S-functions to l evel 2 S-functions, you should build
your S-functions with full (i.e., highest) warning levels. For example, if you
have
gcc on a UNIX system, use these options with the mex utility:
mex CC=gcc CFLAGS=-Wall sfcn.c
If your system has Lint, use this code:
lint -DMATLAB_MEX_FILE -I<matlabroot>/simulink/include
-I<matlabroot>/extern/include sfcn.c
On a PC, to use the highest warning levels, you must create a project file
insideof theintegrateddevelopmentenvironment(IDE)for thecompileryou
are using. W ithin the project file, define
MATLAB_MEX_FILE and a dd
<matlabroot>/simulink/include
<matlabroot>/extern/include
to the path (be sure to build with alignment set to 8).
The following macros are obsolete. Each obsolete macro should be replaced
with the specified macro.