Main Content

Command-Line Arguments

Target Language Compiler Switches

To call the Target Language Compiler, use

tlc [switch1 expr1 switch2 expr2 ...] filename.tlc

This table lists the switches you can use with the Target Language Compiler. Order does not makes a difference. Note that if you specify a switch more than once, the last one takes precedence.

Target Language Compiler Switches


-r filename

Reads a database file (such as an .rtw file). Repeat this option multiple times to load multiple database files into the Target Language Compiler. Omit this option for target language programs that do not depend on the database.


Sets the internal verbosity level to number. Omitting this option sets the verbosity level to 1.


Adds the specified folder to the list of paths to be searched for TLC files.


Specifies that the output produced should be placed in the designated folder, including files opened with %openfile and %closefile, and .log files created in debug mode. To place files in the current folder, use -O (use the capital letter O, not zero).


Specifies the maximum number of errors to report. Omitting this option or omitting the number argument reports only the first error.


Parse TLC file only (do not execute).


Performs some simple checks for performance and obsolete features.


Prints a dot (.) indicating progress for every number of TLC primitive operations executed.


Invokes the TLC’s debug mode.

-da makes TLC execute %assert directives. However, when using the build process, this flag is ignored, because it is superseded by the Enable TLC assertion check box in the Advanced parameters section of the Code Generation pane.

-dc invokes the TLC command-line debugger.

-df filename invokes the TLC debugger and runs the debugger script specified by filename. A debugger script is a text file containing valid debugger commands. TLC searches only the current working folder for the script file.

-dn causes TLC to produce log files indicating which lines were and were not reached during compilation.

-do disables the TLC debugging behavior.


Checks for cyclic records (records that reference each other, a source of memory leaks).


Specifies an initial value, expr, for the identifier, ident, for some parameters; equivalent to the %assign command.


Enables a warning when an identifier-value pair of a record overwrites a local variable. The warning is disabled by default.

-shadow0 disables the warning.

-shadow1 enables the warning.

As an example, the command line

tlc -r myModel.rtw -v grt.tlc

specifies that myModel.rtw should be read and used to process grt.tlc in verbose mode.

Filenames and Search Paths

Target files have the .tlc extension. By default, block-level files have the same name as the Type of the block in which they appear. You can override the search path for target files with your own local versions. The Target Language Compiler finds target files along this path. If you specify additional search paths with the -I switch of the tlc command or via the %addincludepath directive, the search order is:

  1. Current folder.

  2. Include paths specified in %addincludepath directives. The compiler evaluates multiple %addincludepath directives from the bottom up.

  3. Include paths specified at the command line via -I. The compiler evaluates multiple -I options from right to left.


The compiler does not search the MATLAB® path, and will not find a file that is available only on that path. The compiler searches only the locations described above.

Related Topics