02-04-2015 03:41 PM
I cannot find where DAQmxFailed() function is defined. Apparently, it is used all over the place. Please help.
02-04-2015 04:08 PM
DAQmxFailed macro is defined in nidaqmx.h.
You can find actual definition of a term in a CVI program by right-clicking on it and choosing "Go to definition" item in the context menu.
This is valid for variables, macros, functions and even UI objects.
02-04-2015 04:10 PM
I did use that Go To Definition and it did not work.
02-04-2015 04:12 PM
OK, I open that file and it says:
#define DAQmxFailed (error) ((error) < 0)
what does that mean???
02-04-2015 04:29 PM
1. Go to definition works only if you have compiled and linked the project
2. This is a macro the returns TRUE when error < 0. A typical usage of itcan be found in several examples from CVI:
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
The key is DAQmxFailed(error=(functionCall)) instruction: when the program is compiled, DAQmxFailed macro tests the return code from the function where it is used, returns TRUE if the function fails and passes it to calling DAQmxErrChk macro.
02-05-2015 02:01 AM
Hello, hn_sofec!
Some questions:
Note, that beginning with CVI 2013, Go to Definition uses the CVI source code browsing information, generated by CVI, according to the browse information generation policy (Option » Environment » Generate browse information policy). The default value for this setting is On Edit, which means that CVI is generating browsing information whitout requiring a compilation. Note, that CVI 2013 (or later) generates browsing information only from source files (.c files) added to your active project.
On the other hand, CVI 2012 (and earlier versions of CVI) require an explicit successful build of your project, in order for you to benefit from source code navigation.
Assuming you are using CVI 2013, here are some reasons why you cannot find the definition of the macro:
Also, assuming that you are using CVI 2013, can you confirm which types of usages does the DAQmxFailed have?
Are these direct usages in the source code, (e.g. if (DAQmxFailed(error)) { ... }), or only usages inside #define preprocessing directives (e.g. #define MACRO(error) DAQmxFailed(error) )?
Best regards!
- Johannes
02-05-2015 08:46 AM
I am using CVI 2013 SP2. I have not compiled the code yet. I suppose that is the reason Go To Def does not work.
02-05-2015 08:56 AM
I need help understanding this:
1.
#define DAQmxFailed(error) ((error) < 0)
when DAQmxFailed(error) is used, it returns TRUE is error < 0 and FALSE otherwise, correct?
2. and this one:
DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
inside if(), the argument of DAQmxFailed() is an assignment of error = functionCall, correct?
3. why are error in Q1, and functionCall in Q2 placed between parentheses?
02-05-2015 09:33 AM
CVI 2013 SP2 does not require a build of your source code, for you to benefit from browsing information, unless the CVI ADE browsing generation policy is set to On Compile.
Best regards!
- Johannes