From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

what is "fCall" in the head file "toolbox.h"?

Solved!
Go to solution

i want to know, what is "fCall"? where is the definition?i research it everwhere,but cannot find it!

0 Kudos
Message 1 of 4
(4,608 Views)
Solution
Accepted by topic author winter1970

Hi,

 

I think you are referring to the nullChk and errChk macros.

They are macro definitions for error handling.

 

fCall is a placeholder for the function you input to that macro.

Whatever you type in place of fCall is copied-pasted as it is.

 

You call it like: errChk (SetCtrlVal(panel, ctrl, val));

 

This call runs the SetCtrlVal function, returns its result into a variable named error, if the return value is less than 0 then, it jumps to a label named Error.

 

If you call this macro in your code, you need to define the error variable and put a label Error somewhere in your code. Otherwise you get compile errors.

 

Search inside the samples folder to see its usage.

Also read some articles about error handling for more information.

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 4
(4,596 Views)

The SetCtrlVal function I used above was just an example.

 

The key point is, your function has to return negative integer values only for error conditions.

These macros are used to make sure you catch and handle the errors you want during a program execution.

 

Macros are a programming tool for C, but they also open the gates for a lot of problems if not used carefully.

S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 4
(4,593 Views)

thank you for your explain!非常感谢!

0 Kudos
Message 4 of 4
(4,567 Views)