I have two versions of the same Labview program - one with camera control, one without. This is because I do not have enough NI Vision licences for all my systems (some of which have cameras) and a program with vision subvis will not run on a non-NI Vision system.
I want to consolidate these versions into one version that includes the camera controls, but ignores them if the system it is on does not have a camera. Is there a way to programmatically check if a system has the NI-Vision module at runtime? Currently, one cannot even start the main vi if NI Vision is not included because of errors.
You can detect installed NI software at run-time using the System Configuration API Get Installed Software.vi
.
The next step to make your application support the optional presence of a LabVIEW module is to make your application optionally depend on it.
At run time, this is done by dynamically calling VIs. At build time, this is done by removing regions of the block diagram from compilation with a conditional disable structure.
When you place a VI on a block diagram, you are statically linking that VI to your application. Since it is statically linked, the application must be able to find the functions and APIs used at load time.
When you dynamically link a VI, the application doesn't know what VI it will call until your code tells it what to call at run time. By specifying the path and connector pane of the VIs you want to use, you can reference and call them on-demand rather than on-load. NI has a guided tutorial that walks through the setup and usage of this design pattern.