LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

limited definition knowledge

Solved!
Go to solution

Hi,

 

I just came across the following issue with the IDE: CVI provides a nice feature 'Go To Definition', surprisingly it seems not to always work...

 

The test case: In the call to viFindRsrc ( ) I have tried the following regular expression:

 

"ASRL?*INSTR{VI_ATTR_ASRL_WIRE_MODE==VI_ASRL_WIRE_232_DTE || VI_ATTR_ASRL_WIRE_MODE==VI_ASRL_WIRE_232_DCE || VI_ATTR_ASRL_WIRE_MODE==VI_ASRL_WIRE_232_AUTO}"

 

It did not work as expected so I started debugging; right clicking on VI_ATTR_ASRL_WIRE_MODE with Go To Definiton correctly jumped into the correct line of the visa.h file.

 

As expected. However, doing the same for, e.g., VI_ASRL_WIRE_232_DTE gives no result, although this definition can be found few lines below the definition of VI_ATTR_ASRL_WIRE_MODE.

 

So I thought it might be a typo and cut/pasted the constant name from the include file, same result.

 

Somehow Go To Definition does not seem to work in these cases.

 

Am I doing something wrong?

0 Kudos
Message 1 of 5
(4,238 Views)
Solution
Accepted by topic author Wolfgang

Hello Wolfgang,

 

CVI doesn't generate browse info for macros that are not referenced.

For example if you have

#define MY_MACRO 1

no browse info is generated for MY_MACRO. But if you have

#define MY_MACRO 1
...
x = MY_MACRO;

then browse info is generated for MY_MACRO.

 

In your example VI_ATTR_ASRL_WIRE_MODE and VI_ASRL_WIRE_232_DTE are part of a string, not references for those macros.

I assume you are using VI_ATTR_ASRL_WIRE_MODE somewere in your code that makes browse info beeing generated for it but not for VI_ASRL_WIRE_232_DTE.

 

Constantin

0 Kudos
Message 2 of 5
(4,215 Views)

Hello Constantin,

 

Thank you very much for your reply! I have to admit that I did not fully understand it...

 

My environment settings are that browse information is generated on editing, so once I finish typing "VI_ASRL_WIRE_232_DTE" it's in my code, and shortly after typing the browse information has been updated... So I would expect that there is no difference between these two strings... both are in my code...?

 

You are right in that "VI_ATTR_ASRL_WIRE_MODE" is used in a different line of the code as well but this shouldn't make a difference? In my understanding it might make a difference if the browse information would be build only on compilation (or saving), but here?

 

Maybe you give me a second chance?


@Constantin--P wrote:
I assume you are using VI_ATTR_ASRL_WIRE_MODEsomewere in your code that makes browse infobeeing generated for it but not for VI_ASRL_WIRE_232_DTE.

 

0 Kudos
Message 3 of 5
(4,210 Views)

When you write the string you don't reference those macros, you can write whatever you want in that string.

Only if the macro is part of an expression, so it's expanded at precompilation then browse info is generated.

For example if you have

X = MY_MACRO;

there is a refference to symbols X and MY_MACRO;

but if you have

"X = MY_MACRO"

this is just a string, not references to X and MY_MACRO.

 

I hope it's more clear this time.

 

Constantin

 

Message 4 of 5
(4,206 Views)

I've got it Smiley Happy Thanks!

0 Kudos
Message 5 of 5
(4,202 Views)