User`s guide

S-Function Guidelines
is also compiled with your application to run on the target PC. Because of
the following reasons, you must conditionally compile code for the host
PC and the target PC.
- The host PC runs W indows and the target PC runs the xPC Target
kernel.
- The host PC does not have the same I/O hardware as the target PC.
The preprocesso r symbol
MATLAB_MEX_FILE is def in ed whe n you compile
for simulation ( via
mex). Undefine this symbol when compiling for the xPC
Target environment. Use this symbol to conditional ly compile host PC or
target PC specific code. For example:
#ifdef MATLAB_MEX_FILE /* host/simulation */
/* simulation code, t ypic ally nothing */
#else /* target */
/* code to access I/O board */
# endif
IfyouwantthecodetorunonboththehostandtargetPCs,donot
conditionalize the code.
Include the
xpctarget.h file in your S-function.
This prov ides definitions for the functions exported by the xPC Target
kernel. The xPC Target kernel exports a number of functions for use in
device drivers.
See “mdlStart and mdlTerminate Considerations” on page 6-4 f or notes on
specific app li c ations of the callback m ethods.
6-3