PJM_labview Posted February 19, 2021 Report Share Posted February 19, 2021 Does anyone knows if there is a way to programmatically differentiate between "static VI ref" and a "generic (non strict) VI ref"? After some digging up, I came to the conclusion that it is not possible but I would love to be wrong. Thanks Quote Link to comment
Darren Posted February 19, 2021 Report Share Posted February 19, 2021 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? Quote Link to comment
PJM_labview Posted February 19, 2021 Author Report Share Posted February 19, 2021 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 Quote Link to comment
Darren Posted February 20, 2021 Report Share Posted February 20, 2021 (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"? Quote Link to comment
LogMAN Posted February 21, 2021 Report Share Posted February 21, 2021 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. The Strictly Typed VI Reference @Darren mentioned is easily distinguishable from a Generic VI Reference (notice the orange ⭐ on the Static VI Reference). However, if you wire the type specifier to the Open VI Refnum function, the types are - again - indistinguishable. Perhaps you can use VI Scripting to locate Static VI References on the block diagram? Quote Link to comment
The Q Posted February 22, 2021 Report Share Posted February 22, 2021 Doing as @LogMAN suggests, there is a property of the StaticVIReference class the gets/sets the "Is Strict" property. https://labviewwiki.org/wiki/StaticVIReference_class/Is_Strict_property Quote Link to comment
PJM_labview Posted February 22, 2021 Author Report Share Posted February 22, 2021 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. Quote Link to comment
Jim Kring Posted February 27, 2021 Report Share Posted February 27, 2021 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. Quote Link to comment
Darren Posted March 1, 2021 Report Share Posted March 1, 2021 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. 1 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.