The LabVIEW C Code Generator generates C-style source code comments and variable names from the labels on the block diagram. Underscores ( _ ) replace special characters and spaces.
Use VarNames.vi, located in the labview\CCodeGen directory to set the maximum size of variable names, data type prefix strings, and tunnel name abbreviation strings.
![]() | Tip Keep prefix names and tunnel abbreviation strings short to make comments more readable and to avoid truncated variable names or comments. |
The following table shows the LabVIEW signal source and corresponding generated C variable name and comment.
| LabVIEW Signal Source | Attribute Used | Block Diagram Example | Generated C Variable Name | Generated C Comment |
| Front panel control | Label | ![]() | Motor_On | /* Motor On */ |
| Constant | Label | ![]() | Trigger_Level | /* Trigger Level */ |
| Function | Label, terminal name | ![]() | Over_Voltage_x_y__ | /* Over Voltage: x > y?*/ |
| Loop tunnel | Source name, “LT” | ![]() | Trigger_Level_LT | /* Trigger Level: Loop Tunnel */ |
| Case selector | Source name, “CS” | ![]() | Relay_CS | /* Relay: Case Selector */ |
| Case tunnel | Structure Label, “CT” | ![]() | My_Structure_CT | /* My Structure: CT */ |
| Shift register (initialized) | Source name, “SR” | ![]() | Init_SR, Init_SR_1 | /* Init: SR */, /* Init: SR 1 */ |
| Shift register (uninitialized) | Source name, “SR” | ![]() | Foo_Loop_SR, Foo_Loop_SR_1, Foo_Loop_SR_2 | /* Foo Loop: SR */, /* Foo Loop: SR 1 */, /* Foo Loop: SR 2 */ |
| Sequence Local | Source name, “SL” | ![]() | Init_SL | /* Init: Sequence local */ |
| Sequence tunnel | Source name, “ST” | ![]() | Level_Y_ST | /* Level Y: ST */ |
| Structure terminal | Label, terminal name | ![]() | Wave_Loop_i | /* Wave Loop: i */ |
| Local variable | Label, local variable name | ![]() | Motor_Control | /* Motor Control */ |
| Global variable | Label, global variable name | ![]() | sensors_Temp_1 | /* sensors: Temp 1 */ |
| User VI | Label, terminal name | ![]() | Filter_Analog | /* Filter: Analog */ |
![]() | Note Generated variables must be unique. If multiple variables have identical names, the LabVIEW C Code Generator appends a sequential number to the end of the variable name to make the name unique. |