Jump to content

programmatically differentiate between "static VI ref" and a "generic (non strict) VI ref"


Recommended Posts

2 hours ago, Darren said:

Are you talking about inspecting the data type of the two wires with the blue arrows to discern which one is strict and which one is not? Or are you asking for something else?

Hi Darren,

I did look at the type string, but because both are non strict they are identical (see image).

I also looked at the variant introspection vi for reference "Get Refnum Information.vi" but it return the "vi server generic type" as "kLVObjVI" for both (so no luck that way either).

Thanks

image.png.96073e718d46b9598ff3fa2d7fcc6546.png

Link to comment

(I'm not at a machine with LabVIEW at the moment, so I apologize if I'm not remembering some of this correctly)

I see that the static VI reference in your screenshot does not have the little orange star in the corner, which means it's not a strict reference. If you were to wire that reference into a Call By Reference function, you wouldn't see a connector pane pattern. So as your diagram is currently implemented, the types of those wires are identical since the static VI reference wire doesn't contain any type info. Isn't that right? Can you right-click the static VI reference and select something like "Include Data Type"?

Link to comment

A Static VI Reference is simply a constant Generic VI Reference. There is no way to distinguish one from another.

It's like asking for the difference between a string constant and a string returned by a function.

image.png.61a89f3cbc440f7f977043885c92e599.png

image.png.ab57b310b8bbdd43fd413d04fe0b4806.png

The Strictly Typed VI Reference @Darren mentioned is easily distinguishable from a Generic VI Reference (notice the orange  on the Static VI Reference).

image.png.1ff3698c7c877ecc0c26748fbec9335b.png

image.png.171f3fad1025c289730826b0a6db4787.png

However, if you wire the type specifier to the Open VI Refnum function, the types are - again - indistinguishable.

image.png.cf4f2b8db94e390020c355adf4fd9422.png

image.png.039ead787aad17fa2558614aac2437ca.png

Perhaps you can use VI Scripting to locate Static VI References on the block diagram?

Link to comment

Thanks for all the answers

While both type are identical (between no strict static vi ref and non strict generic vi ref) the behavior expressed while using either of these are not identical. For instance, doing a run vi method on the first one (static vi ref) with the auto dispose flag set to true will not dispose of the ref (makes sense to me) and doing the same thing on the later (generic vi ref obtain with the open vi ref) will dispose of the reference (again, this makes sense to me). 

In conclusion, knowing which type is "passed in" (a subvi) has some benefit that could be leveraged.

Link to comment

Based on some conversations I had with Philippe about this, he's wondering:

If you have a VI reference at run-time, can you tell whether it is a static VI reference (via Static VI Reference node) or a dynamic VI reference (opened with the Open VI Reference) function, since the VI lifetimes (and lifetimes of references created within them) are managed differently by LabVIEW.

Link to comment
On 2/27/2021 at 12:37 AM, Jim Kring said:

If you have a VI reference at run-time, can you tell whether it is a static VI reference (via Static VI Reference node) or a dynamic VI reference (opened with the Open VI Reference) function, since the VI lifetimes (and lifetimes of references created within them) are managed differently by LabVIEW.

I checked with LabVIEW R&D, they said there is no way to determine this information in G code.

  • Like 1
  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.