User`s guide

B Custom I/O Driver Blocks Reference
B-2
I/O Register Access from S-Functions Limitation
For Windows NT, Windows 2000, and Windows XP, drivers can access I/O
registers only from the real-time kernel and not from Simulink. To ensure that
drivers do not attempt to access I/O registers from Simulink S-functions, enter
code fragments like the following as appropriate:
#ifndef MATLAB_MEX_FILE
/* we are in RTWin kernel, safe to do board I/O */
#else
/* we are in Simulink, don't do board I/O */
#endif