LabVIEW C Generator Module

C Code Generation Settings Page

  • Updated2023-02-21
  • 2 minute(s) read

Requires: C Generator

Use this page of the C Code Generation Properties dialog box to specify C code generation settings and optimizations for all VIs in the hierarchy of the exported VI.

This page includes the following components:

  • Processor Properties—Specifies processor-specific settings for the target on which you want to use the generated C code.
    • Endian format—Specifies the byte order of data in the generated C code. Byte order, or endian format, indicates whether integers are represented in memory from most-significant byte to least-significant byte, or vice versa. The function must read the data in the same byte order that the data is written.
      • Big endian—Specifies that the most-significant byte occupies the lowest memory address.
      • Little endian—Specifies that the least-significant byte occupies the lowest memory address.
    • Alignment—Specifies the memory padding value to which the C Generator forces internal data structures. This value must match the alignment value for the double data type on the processor.
  • Memory Options—Specifies how to manage memory in the generated C code.
    • Use stack variables—Uses stack variables rather than heap variables to represent signals in the generated C code. Using stack variables enables better C compiler optimizations and makes the C code faster.
  • Optimizations—Specifies which optimization rules to use when generating C code.
    • Expression folding—Generates better performing and more efficient code by collapsing groups of nodes into single expressions that are recognized easily by C compilers. If you overrun the bounds of an array or divide by zero, the application in which you use the generated C code might crash.
    • Generate guard code—Generates extra code to prevent common coding mistakes that can cause an application to crash or function incorrectly. For example, guard code can prevent dividing by zero or indexing out of range in an array. Guard code makes an application slightly larger and slower.
    • Generate integer only—Generates C code without any floating-point declarations or operations. This option creates a smaller application because it does not link any floating point-specific libraries.
    • Treat doubles as singles—Treats double-precision, floating-point numbers as single-precision, floating-point numbers in the generated C code. This option is useful if the platform does not support double-precision, floating-point numbers.
    • Preserve state—Keeps the values for uninitialized shift registers and first call variables in order to preserve state information between subsequent calls to an exported function. The C Generator generates a CCG_Cleanup function that you can use to clear or reset the state.

      (Control Design and Simulation Module) You must enable this option when using single-stepping on a simulation subsystem.

Log in to get a better experience