08-13-2009 01:53 PM
I have read several threads on this topic (i.e. http://forums.ni.com/ni/board/message?board.id=170&message.id=382207&query.id=312005#M382207) , but it still does not work. Here I describe the problems again.
I’m using a network shared variable in two compiled executables (on the same computer). It works fine since the PC has LabVIEW development system installed, although I was not in the development environment when running the executables. I copied the same executables to the other PC which has the runtime engine installed only. The two executables stop communicating via the shared variable. Seems to me that the second PC is missing something. Some people were talking about the SVE (Shared Variable Engine), but where do I find it? I found the Variable Engine (VE). Is it the same as SVE? I’m attaching the files I have and hope someone can help me on this.
Thanks.
08-13-2009 05:16 PM
Here is a thread from some time back that dealt with Shared Variables in executables:
http://forums.ni.com/ni/board/message?board.id=170&message.id=230033&query.id=342419#M230033
I'm sorry, I haven't looked at your code directly to see what the problem is as I do not have much time for this post.
I'm not sure I ever fully understood the most graceful way of using Shared Variables. Shared variables seem like they work really well when dealing with 2 computers with full LabVIEW installed, but their ease-of-use falls apart once you go into the realm of executables. I fought this same battle, won it, and then abandoned Shared Variables. Decided that DataSockets (although dated) had a much easier paradigm to work with. Let me describe how I got shared variables to work for me. I highly recommend you look into DataSockets as a possible alternative.
In general, a few things have to happen (this is so crude, and I would love it if someone who knew what was going on with shared variables stepped in and explained a more graceful approach if one exists):
1. You need to develop a "server" and "client" shared variable libraries. The "client" shared variables must point to the server computer (by name) and the specific shared variable (by name) as well as know what the data type is. I recommend you add generic names for these in HOSTS (C:\Windows\System32\etc\HOSTS) that point to the network IP addresses. I chose SVHost as the name of the shared variable host. If you have access to your local network's DNS server there is another option.
2. Both the server and the client must deploy their library before use. See thread I linked to above. There is an application level invoke node for deploying a library, and you must wire the path to the library that contains your shared variables to it.
3. You must install the Variable Engine on both machines. The easiest way to do this is to make a custom installer. After you create an "application" build specification, add an "Installer" build specification. In the installer dialog go to "Additional Installers" and check the "Variable Engine." You will see in the help for that particular install that it adds support for Shared Variables.
Now, why didn't I like this? It seemed really useless to me that the server and client names had to be pre-defined before you could use shared variables. Also, you couldn't come up with shared variables on the side. ALSO, whenever you created a shared variable you had to do it in both the client and server libraries and made sure that they matched. Just so much room for error. LabVIEW 2009 includes a number of shared variable subVIs that may make them more usable.
Check out DataSockets. So much easier to use IMHO. Just start the DataScoket server, define access restrictions, and start pushing and pulling data. You can make up your data types on the fly. Works well with passing simple messages between applications across a network. I have not tried it with Waveform type data yet.
-Nic