After you develop the VI for C code generation, customize the platform definition file, define C code generation options, and configure the exported function prototype, you can generate C code from the exported VI. In the C Code Generation build specification, click the Build button to generate C code. You also can right-click the C Code Generation build specification in the Project Explorer window and select Build from the shortcut menu to generate C code.
The LabVIEW C Generator uses the options you specify in the C Code Generation Properties dialog box to generate C code from the block diagram. The C Generator generates each VI in the VI hierarchy into a separate C file using a C function name, which is more restrictive than a VI name. Any non-alphanumeric characters become underscores. If the VI name begins with a non-alphanumeric character, the C Generator prepends A_ to the beginning of the C function name.
The C Generator generates the following files:
|Note LabVIEW code depends on the LabVIEW run-time library, which includes support for all basic functions. You must link to the LabVIEW run-time library with all exported VIs. The LabVIEW run-time library source is located in the labview\CCodeGen\libsrc directory. You also must link to the LabVIEW analysis library if the exported VI uses math or signal processing VIs. The LabVIEW analysis library source is located in the labview\CCodeGen\analysis directory. You also must link to the LabVIEW simulation library if the exported VI uses the Simulation VIs and functions. The LabVIEW simulation library source is located in the labview\CCodeGen\simulation.|
DllMain.c, which is not created when the C Generator generates C code, is an example entry point for a DLL. This file is required for building DLLs that run on Windows. This file is located in the labview\CCodeGen\libsrc\platform\win directory.
|Tip To open the directory containing the generated C files, right-click the C Code Generation build specification in the Project Explorer window and select Explore from the shortcut menu.|
To delete all generated *.c and *.h files in the destination directory for an exported VI, right-click the C Code Generation build specification in the Project Explorer window and select Clean from the shortcut menu. The Clean option does not delete makefiles or built libraries.