Target Language Compiler    

Appendix B

TLC Error Handling


Generating Errors from TLC-Files

To generate errors from TLC files, use the %exit directive. The two types of errors are:

Usage errors
These can be caused by incorrect models.
Internal coding errors
These cannot be caused by incorrect models.

Usage Errors

Usage errors are errors that can happen by incorrect models or other attributes defined on a model. For example, suppose you have an S-Function block and an inline TLC file for a specific D/A device. If a model can contain only one copy of this S-function, then an error needs to be generated for a model that contains two copies of this S-Function block.

Using Library Functions

To generate usage errors related to a specific block, use the library function

The block argument is the block record if it isn't scoped. If the block is currently scoped, then you can specify block as [].

To generate general usage errors that are not related to a specific block, use

These library functions prepend the string Real-Time Workshop Error to the message you provide when reporting the error.

For an example usage of these functions, refer to gensfun.tlc for block errors and commonsetup.tlc for common errors. There are other files that use these functions in the directory matlabroot/rtw/c/tlc.


 Linear Block Specific Records Fatal (Internal) TLC Coding Errors