Understanding Overridden SubVI Calls in Generated C Code (C Generator)
- Updated2023-02-21
- 3 minute(s) read
Funclist files are XML files that contain entries that enable you to override subVI calls with a fragment of C code. For example in C code generated by the LabVIEW C Generator, the CCG Mem Peek 8 VI has an alternate implementation that makes direct calls to a C function. You can modify Funclist entries to provide an alternative implementation for VIs that ship with LabVIEW or VIs you create. Funclist files are useful when you wrap high-performance, target-specific C function calls into subVIs. Creating subVI wrappers provide a better experience in LabVIEW so you can have the ease of use of LabVIEW and the performance of an optimized C function call.
![]() |
Caution Funclist entries have specific formatting requirements and contain little error checking. If the formatting is incorrect, compiler errors occur, and LabVIEW might crash when you generate C code. |
Funclist files contain lines, or Funclist entries, that describe how to replace a subVI call in the generated C code with a fragment of C code. These code fragments can be anything, but they are usually C function calls. The C Generator includes Funclist files for some VIs that ship with LabVIEW in the labview\CCodeGen\Funclist directory. For example, Memory Access.xml contains Funclist entries for the Memory Access VIs. If you create a Funclist file for VIs you create, you must include that Funclist file in the labview\CCodeGen\Funclist directory.
Each Funclist entry must contain the <VI Name>, <Function>, and <Features> tags. The following example shows the Funclist entry for the CCG Mem Peek 8 VI:
<VI Override>
<VI Name>CCG_Mem_Peek_8</VI Name>
<Function>@CCG_Mem_Peek_8( @i2, @i1(0), @o3, @o2, @o1 );</Function>
<Feature>CGenMemPeek</Feature>
<VI Override>
<VI Name>
The <VI Name> tags contain the name of the VI you are overriding. In the Funclist entry, you must change the VI name in the following ways:
- Convert spaces to underscores.
- If the VI begins with an underscore, prepend A__ to the VI name.
<Function>
The <Function> tags contain the line of C code that replaces the subVI call. If you call a C function, the <Function> tags contain the function parameters.
You must pass the function parameters directly. When you pass parameters, you must do the following things in the Funclist entry:
- Place an @ character at the beginning of the line of C code.
- Use a format code in the form @ xn to access the subVI inputs and outputs. x represents a character that determines if the parameter is an input or output and the way the C Generator passes the parameter.
For x, use the following characters to indicate how the C Generator passes the parameter:
- I is an input passed by reference.
- i is an input passed by value.
- o is an output passed by reference.
- it is the type of input.
n is the number of the input or output on the connector pane. The numbering on the connector pane is not intuitive. You might have to use trial and error to find the correct number. - Place a value in parentheses after a format code to specify a default, or unwired, value for the input. For example, if you want to pass input 3 by reference with Null as the default value, the syntax is @I3(Null).
<Feature>
The <Features> tags contain a string that describes the feature you are overriding. You can use any string in the <Feature> tags as long as the string is a valid C identifier and the string is unique to the other <Feature> strings in the Funclist file.
