Hand-written S-functions without corresponding TLC files must contain exception-free code. For more information on exception-free code, refer to "Exception-Free Code" in Writing S-Functions.
If you modify the source model that generated an S-Function block, the Real-Time Workshop does not automatically rebuild models containing the generated S-Function block.