Understanding errChk in LabWindows™/CVI™

Updated May 11, 2023

Reported In


  • LabWindows/CVI Base
  • LabWindows/CVI Full

Issue Details

I am trying to understand errChk in LabWindows™/CVI™. Where can I find its definition?


You can find the definition of errChk in toolbox.h at: 
<Program Files>\National Instruments\CVIXX\toolslib\toolbox\toolbox.h 
errChk is a convenient macro you can place around your function calls to force an automatic jump to a function’s error handling code. This is analogous to exception handling in other languages. 

Additional Information

The errChk macro is mostly used around a function call that might return an error. The macro evaluates the return value of the function, and if the error is negative it jumps to the code following an "Error:" label that you should define at the bottom of the code. The code following that error label is meant to clean up any resources created by the previously executed code and to propagate the error up to the calling function.