ssSetLocalErrorStatus
Report an error in a thread-safe manner
Syntax
void ssSetLocalErrorStatus(SimStruct *S, const char_T *msg)
Arguments
S
SimStruct that represents an S-Function block or a Simulink® model.
msg
Error message.
Description
Use this function for thread-safe reporting of errors that occur in your S-function. For example:
ssSetLocalErrorStatus(S, "error message"); return;
Note
The error message character vector must be in persistent memory; it cannot be
a local variable. If you use sprintf
to format the error
message, you must allocate memory for the message. For example:
static char msg[35]; sprintf(msg,"Expected number of parameters: %d",ssGetNumSFcnParams(S)); ssSetLocalErrorStatus(S,msg);
Calling ssSetLocalErrorStatus
does not cause the Simulink engine to stop and display the specified error message.
ssSetLocalErrorStatus
call should be followed by a return
statement to skip the rest of the function where
ssSetLocalErrorStatus
resides.
ssSetLocalErrorStatus
reports the first error if there are
successive calls to ssSetLocalErrorStatus
. The function does not
generate an exception. Thus you can use it in your S-function to avoid creating
exceptions when reporting errors.
Use this function for applications to run on R2019a or later for thread safety.
For earlier releases, use ssSetErrorStatus
instead.
Languages
C, C++
Version History
Introduced in R2019a