LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is code in a disable structure included in an executable?

I have a LabVIEW 8.6 VI that I would like to build into an executable.  This code includes several PXI drivers for motion control and power supply control.  I have a hardware simulation mode built into the code that will allow me to run the front panel regardless of whether the software is running with hardware or not.  There are case structures around each of the hardware driver VIs in the software.  If I am running the code normally, the cases with the hardware driver VIs will be called and they will operate the connected hardware.  If I am running the code in hardware simulation mode, the cases with VIs that fake hardware will be called.  All of this works as I intended.  The problem comes when I try to build the code into an executable and distribute it to people who I know don't have the hardware, and probably don't even have LabVIEW installed.  The problem is that these people will have to install the NI runtime support (which I am perfectly fine with) but they will also have to install the drivers for the hardware that they don't have.

 

I am wondering if I were to change the case structures to conditional disable structures and disable the drivers, would that code still be included in the executable and require someone to install unused drivers to run the simulated code?

Eric C
Systems Integrator, National Technical Systems
Certified LabVIEW Architect
0 Kudos
Message 1 of 5
(2,863 Views)

Hi Eric C,

i'm not sure if you can solve it with a conditional disable stucture, but you can use dynamic calls of your drivers. All your code is still in the exe, but it would only be loaded if you need it. The difference to a case structure is, that your drivers are only in memory if you really need it, but with a case structure they will always be in memory.

 

Hope it helps.

Mike

0 Kudos
Message 2 of 5
(2,832 Views)

Hi Eric C,

 

Good Morning and I hope your well today.


Thanks for your interesting post! 

 

I would like to highlight one aspect of the help file, " ..Has one or more subdiagrams, exactly one of which LabVIEW uses for the duration of execution,..". To me, this suggests at run time only one case will be valid. Thus, I don't believe this will act as you wish. Secondly, I am under the impression that this can't be used in an executable (compiled form - I got an error 1 when trying to). This maybe because the exe can't decide what case to use. Due to the above, I feel we should look at this issue from a different angle. 

 

To make it clearer, once the code is deployed there is no longer the conditional structure OR the code in the other frames. (There are however if your making a source distribution). 

 

I am guessing your driver would be calling third party dlls, and the exe will load these at the beginning. So this is likely to generate the browse window is the driver isn't installed. In your documentation you could include that this means you need to install the driver. If your user was then to run the code you could use a case structure and test that the file has been created by the installer for the driver (I.e. no install directory no driver). This would then prevent the end user running the application without the driver.

 

Thus, if you feel its not ideal the customer sees the browse window then you could run the installer for the driver at the end of the NI installer, which you could include when you distribute your application.

 

Please let me know  your thoughts, 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 3 of 5
(2,817 Views)
Thank you guys for your prompt replies.  They gave me some good things to think about.  However, I was still curious whether I could do this with conditional disables or not.  I talked with one of my coworkers this morning and it turns out he has actually done this before.  Trusting his advice, I went ahead and put in the time this morning and converted everything from case statements to conditional disable structures.  Sure enough it worked.  I was able to install the LabVIEW Runtime environment on a fresh computer and then run my executable without having to install the drivers.  It would seem then that disabled code is not included in an executable after all.  Problem solved.  Thanks again for all of your suggestions.  I can see them coming in handy in other situations.
Eric C
Systems Integrator, National Technical Systems
Certified LabVIEW Architect
0 Kudos
Message 4 of 5
(2,798 Views)

Hi Hillman,

 

According to this thread, what you say should not work. I tested on LV2009SP1, and SubVIs included in disabled conditional subdiagrams get included in my executable, which is not the expected behaviour (I checked that they are not called anywhere else, of course)

 

Best

Charles

0 Kudos
Message 5 of 5
(2,671 Views)