Admin Production ni-theme
Current Publication

Interactive Execution Window

LabWindows/CVI

Interactive Execution Window

You can execute selected portions of code in the Interactive Execution window. Unlike the Source window, you do not need a complete program in the Interactive Execution window. For instance, you can execute C variable declarations and assignment statements without declaring a main function.

Use the Interactive Execution window to test portions of code before you include them in your main program. Also, you can use the Interactive Execution window to execute functions exported by a loaded instrument or by a file in the project if the project has been linked. The Interactive Execution window can access functions and data declared as global in a Source window, but a Source window has no access to the functions and data declared in the Interactive Execution window.

When you execute a function from a function panel, LabWindows/CVI inserts the function call into the Interactive Execution window for execution. In this way, the Interactive Execution window keeps a record of the functions you execute from function panels.

When LabWindows/CVI copies a function call from a function panel to the Interactive Execution window for execution, it inserts the code after all the existing lines. LabWindows/CVI also inserts an include statement for the header file associated with the function in the Interactive Execution window if you have not already included it. When you execute a function call from a function panel, LabWindows/CVI automatically excludes all previous lines in the Interactive Execution window. An excluded line is dimmed and the LabWindows/CVI compiler ignores it.

Because LabWindows/CVI automatically excludes all declarations when you execute code in the Interactive Execution window, you must avoid placing executable statements on the same line as declarations in the Interactive Execution window. Auto-exclusion also occurs when you type a line of code beneath a line that has just been executed. You can manually exclude and include lines with the Edit»Toggle Exclusion command.

Declarations in the Interactive Execution window remain in effect until you select Build»Clear Interactive Declarations or Edit»Clear Window.

Use the following rules for executing code in the Interactive Execution window.

  • Make sure that data declarations precede any program statements and that functions are declared before they are used.
  • You cannot include function definitions in the Interactive Execution window. LabWindows/CVI treats the following statements the same:

    extern int fn (void);
    int fn (void);

    LabWindows/CVI treats the following statements as errors:

    static int fn (void);
    static int fn () {}
  • LabWindows/CVI treats all global data declarations in the Interactive Execution window as if they are declared as static unless the extern keyword precedes them. If the extern keyword precedes them, the global declaration must exist in a loaded instrument or in a file in the project.

    The following data declaration is invalid in the Interactive Execution window:

    extern int x=6;
  • If you want to run functions from certain libraries in the Interactive Execution window while a LabWindows/CVI project is suspended, make sure you complete the following to avoid unresolved symbol errors:
    • Select the Enable LoadExternalModule option in the Target Settings dialog box.
    • Click the Add Files to Executable button in the Target Settings dialog box and select the .lib or .obj file that corresponds to the LabWindows/CVI library function you want to execute in the Interactive Execution window. For example, to execute the WhiteNoise function, select analysis.lib.

You can drag text from the Interactive Execution window into different LabWindows/CVI environment windows.