03-15-2011 11:12 AM
I am trying to release a LV 2010 application comprised of a top level VI (Main.vi) and a number of dynamically called VIs communicating with the first one using functional global variables (and a few classic global variables).
One of the dynamic subVIs (Second.vi) can in fact be used independently from Main.vi (and often will be). I would like it to be available as an .exe, but I would also like it to be able to communicate with Main.exe if the latter is launched after Second.exe. Is that in any way possible?
To me, it seems that I would need to write the two VIs as independent applications (and release them as such, but in the same application folder) and find another way to enable data exchange between the two (which, I have no clue). Is there a simpler way I am missing? Setting both VIs as top level VIs in the Build specification will almost do what I want but not quite, since it will open both VIs no matter whether I want to run Main.vi only or Second.vi only (and of course only show on single .exe file in the application folder).
Solved! Go to Solution.
03-15-2011 12:00 PM
As soon as you build second.vi into a standalone executable, it will operate in its own dataspace outside of main.exe. The common dependencies (functional global) will be included within each build and will run independently, so I don't think you can share the dataspace between the applications. The best solution is to ensure one application is always launched by the other, but I'm not aware of LabVIEW being able to launch a vi that's built into a separate exe dynamically (it can certainly launch a vi from within itself of course).
Depending on how much data you need to share, the best way might be to use Network Shared Variables or UDP communications on the localhost IP. If you have just some basic settings and infrequently changing data, used NSVs, otherwise set up a simple UDP comms thread that works on the localhost address.
Do you absolutely have to have the two VIs available as separate executables? If you built main.vi and second.vi into a single packed library and place it into the support folder of a 'launcher' VI built as an executable with a simple User Interface that gives the operator a choice of which application to launch, then if the operator launches Second.vi first, then Main.vi later, the two will exist in the same dataspace and will be able to share the functional global. The launcher VI exe could hide it's front panel as soon as you've selected either "Main.vi" or "second.vi", or could just dock to the taskbar.
I don't think there's a simple solution to your problem I'm afraid, but if anyone knows of one I'd be interested to learn about it!
03-15-2011 12:07 PM
I had thought about the Launcher VI idea, but that's not really providing the same experience to the user as a Program Folder with two distinct executable modules that one can choose independently from one another. If I could generate two shortcuts that would represent two different calls to the same launcher VI with two different parameters, then I guess that would be close enough to the desired behavior. I don't know how to do that, though...
03-15-2011 05:02 PM
You could do it using passed arguments to the exe. This document gives an example "Pass Arguments to a LabVIEW executable". I think you can just build the shortcuts in the Application Builder but you might have to generate them buy running a post install tool.
Jason
03-16-2011 12:55 PM
Thanks, Jason. I still have to test it, but that sounds like a manageable solution. I also will have to find a way to give those shortcut the same icon as my application...