LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
rcpacini

Type Casting Strictly Typed VIs

Status: New

Allow type casting between Strictly Typed VI References

TypeCastVI.png

Why:

The asynchronous methods require strictly typed VIs. Strictly typed VIs depend on the connector pane and terminal wiring type (Required, Recommended, Optional). Depending on your development environment and configuration options (Front Panel > Connector pane terminals default to required), newly connected terminals may be Required -or- Recommended. 

Opening a VI reference or calling an async method with the wrong terminal wiring type will result in Error 1057: Type mismatch. 

TypeCastVI_Justification2.png

To work around the connector pane variance, we need to type cast check every connector pane terminal variance in order to call the proper async method without getting the Type Mismatch error.

TypeCastVI_Current.png

The amount of unnecessary complexity to call and collect a thread is infuriating. There is already enough complexity when it comes to spawning a new threads; between the conditional options (Non-Reentrant, Reentrant, Async Forget, Async Collect), VI type specifier (Generic, Strict), Connector Pane Type (Pattern, Rotation), Terminal Wiring Types (Required, Recommended, Optional), etc. Threading in LabVIEW needs improvement.

Idea:

To better support Asynchronous calls, we need the ability type cast the required strictly typed VIs to:

1. Add an option to Start Asynchronous Call and Wait on Asynchronous Call methods to ignore the VI terminal wiring type flags:

     Required (0x21000), Recommended (0x20800), Optional (0x20000)

2. Support type casting VIs To More Generic Type and To More Specific Type to avoid the error 1057 Type Mismatch all together

TypeCastVI_Idea.png

Regards,

A LabVIEW Enthusiast 

2 Comments
MichaelBalzer
Active Participant

Could you elaborate on why you'd want to support all the different connector pane variants, instead of using the strict static VI reference already available? If a VI connector pane can be type cast so required inputs are no longer required, that breaks any API contract. If an input is required, that's usually a conscious decision by the VI author, and shouldn't be able to be overidden by the caller.

 

I've always wired the strictly typed static VI reference into the type specifier VI refnum input of Open VI Reference, as shown in the last example (minus the type casts). Then any changes to that statically referenced VI's connector pane are automatically reflected downstream when opening and calling it. One minor difference is that I typically use the VI's name instead of the path when opening a reference to it.

 

 




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
AristosQueue (NI)
NI Employee (retired)

What you are showing with the Variant casting shouldn't work. I didn't know that backdoor was open. That's not stable. There isn't supposed to be a way to cast away the requiredness of terminals -- that's why type cast node doesn't allow it. I will file the bug to close that functionality.