Admin Production ni-theme
Current Publication

Debugging Programs and Running Interactive Statements

LabWindows/CVI

Run»Debug

This menu item varies depending on the option you select in the Build»Target Type submenu.

  • If you select Build»Target Type»Executable in the Workspace window, the Debug menu item runs the project target executable for the currently selected configuration. To set the active configuration, select one of the items in the Build»Configuration submenu.
  • If you select Build»Target Type»Dynamic Link Library in the Workspace window, the Debug menu item runs the executable you specify with the Specify Executable and Command Line command. Before running the executable, the Debug menu item compiles any source files that must be compiled and builds the project target executable or DLL if you made changes since you last built the target DLL or executable.
  • If you select Build»Target Type»Static Library in the Workspace window, the Run»Debug menu item is dimmed.

You can continue to edit code, open windows, and interact with LabWindows/CVI while you debug a project.

Note Note  Although you can edit source code while you suspend program execution, those changes do not take effect immediately, even if you save the file. You must terminate execution and rebuild the project to see your changes.

Running Interactive Statements

In the Interactive Execution window, this menu item becomes Run»Run Interactive Statements. Select Run Interactive Statements to execute code in that window. You do not need to enter a complete program in the Interactive Execution window. For instance, you can execute variable declarations and assignment statements in C without declaring a main function.

You can use the Interactive Execution window to test portions of code before including them in the primary program. You also 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 cannot access the functions and data declared in the Interactive Execution window.

LabWindows/CVI does not disturb asynchronous I/O, RS-232 ports, opened files, and User Interface Library resources you use in the Interactive Execution window at the beginning or end of execution in the Interactive Execution window. LabWindows/CVI terminates, closes, or deletes these program elements only when you perform one of the following actions:

  • Select Build»Clear Interactive Declarations.
  • Select Edit»Clear Window.
  • Link a project.
  • Run a project.

Run-Time Error Reporting

LabWindows/CVI reports various run-time errors during the execution of a program. One example of a run-time error is a call to a LabWindows/CVI library function with an array or string that is too small to hold the output data.

When such errors occur, a dialog box appears identifying the type of error and the location in the file where the error occurred. LabWindows/CVI then displays the error in the Run-Time Errors window.

LabWindows/CVI suspends the program so you can inspect the values of variables in the Variables and Call Stack window. To terminate a program that suspended because of a run-time error, select Run»Terminate Execution or use the default shortcut key <Ctrl-F12> while a LabWindows/CVI environment window is active.