User:Flarn2006/Sandbox
A generic VI is any VI which contains generic controls and/or indicators. Generic controls and indicators automatically change to match whatever type is wired to them, similar to polymorphic VIs. Unlike polymorphic VIs, however, a generic VI can accept any type, and all its code needs only to be implemented once. While this sounds quite useful, the use of generic VIs has been officially condemned by NI, as they are very likely to cause serious problems.
Origin
The first generic VI was published[1] by Aristos Queue on June 24, 2010. Randomize 1D Array.vi, the aforementioned generic VI, accepted an array of any type, and would output the same array except in a different, pseudorandom order. Aristos later announced that "the beta test [was] finished; the VIs are no longer available for download because instabilities [had] been identified."[1] The VI is still available, however, through the Internet Archive's Wayback Machine.[2]
Creating generic VIs
Although Randomize 1D Array.vi was password protected, the control and indicator were copied anyway, and posted to the LAVA forums by flarn2006.[3] This allowed the creation of custom generic VIs. If a generic control or indicator is put in an array, the terminal will only accept arrays of that dimension, except any array type can be used. Similarly, a generic control or indicator can be placed in a cluster, and it will only accept that cluster type, except with any type in place of the generic control.
Disclaimer
As was mentioned before, generic VIs are NOT supported in any way by National Instruments. Due to several issues, they are not under any circumstances to be used in any production code. The information on this page is intended only for exploration and experimentation with a private feature of LabVIEW, and not for use in any serious work.
External Links
- [Original thread on NI's official forums about generic VIs http://forums.ni.com/t5/LabVIEW-Developers-Feature/Now-available-for-download-quot-Randomize-1D-Array-vi-quot-that/td-p/1159329]
- [LAVA thread detailing creation of generic VIs http://lavag.org/topic/15870-create-your-own-generic-vi-like-randomize-1d-array/]