Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
49 ratings:
 3.14 out of 5     Rate this Document

How Do I Deploy Network Shared Variables from a Compiled Executable?



Primary Software:
Primary Software Version: 8.5
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I have created an executable that contains network shared variables, but when I try to run the program, it appears that the variables do not deploy automatically. How do I deploy the shared variables?

Solution:
LabVIEW 2009 and Later
In LabVIEW 2009, functionality was introduced into the Application Builder to deploy shared variable libraries at run time.  This option is available in the build specifications for the compiled executable and greatly simplifies and reduces the coding required to use shared variables with compiled executables.

To deploy shared variable libraries in executables built in LabVIEW 2009, follow these steps (and refer to the image below):
  1. In Build Specifications, select Shared Variable Deployment.
  2. To deploy the libraries at application execution time, check the box titled Deploy shared variable libraries at application execution.
  3. To undeploy libraries when the application finishes, check the box titled Undeploy shared variable libraries at application exit.


Note: The method described below for versions of LabVIEW prior to 2009 is still valid for LabVIEW 2009.  Also, code written in previous versions that is upgraded and compiled into LabVIEW 2009 that uses the method described below need not be updated to use the method described above.

Before LabVIEW 2009
In order to use a network shared variable in a compiled executable in versions of LabVIEW prior to LabVIEW 2009, it is necessary to first deploy the shared variables before they are to be used in the program. When you create a new application (EXE), under Build Specifications»Application (exe)»Source Files, add your top level VI as the Startup VI and then add all libraries that contain network shared variables to the Always Include (previously Support Files) list. Also, make sure to set the Destination of the libraries to be Support Directory in the Source File Settings category.

Deploying Shared Variables From Windows
This can be done by utilizing the Deploy Library method of an Application Control. To find the Deploy Library method:
  1. Right-click the block diagram to bring up the programming palette and go to Programming»Application Control and place the Invoke Node on the block diagram
  2. Using the hand tool, click Method and select Library»Deploy Library
  3. Use the Path input of the Deploy Library invoke node to point to the libraries containing your shared variables. If the libraries were included in the executable's Support Directory, as directed above, the libraries will be copied to the executable's data folder. Point the Path input to these libraries.
If you are using LabVIEW Datalogging and Supervisory Control, you should use the Deploy Library function to deploy your shared variables. To find the Deploy Library VI:
  1. Right-click the block diagram to bring up the functions palette and go to DSC Module»Engine Control»Libraries & Processes (DSC Module»Engine Control before LabVIEW 8.5) and place the Deploy Library function on the block diagram
  2. Use the Path input to the Deploy Library function to point to the libraries containing your shared variables

Note: If the application you want to build uses VI Server properties and methods or DSC VIs to modify a library or shared variables within a library, place a checkmark in the Enable Enhanced DSC Runtime Support checkbox on the Advanced page of the Application Properties dialog box shown below. If you are planning to distribute this application to a machine without LabVIEW DSC installed, also be sure to check the NI Enhanced DSC Deployment Support in the Additional Installers section of the installer properties.

Deploying Shared Variables to a Real-Time (RT)Target
If you are compiling an executable to be run on a real-time target, you may either manually deploy the shared variables from the Project Explorer window or programmatically deploy the shared variables from the PC to the real-time target using the Application invoke node.

In the Project Explorer, right-click each of the libraries you wish to deploy on your real-time target and select Deploy All. The network shared variables that are deployed onto the real-time target will persist until you manually undeploy them. To undeploy network shared variables:

  1. In LabVIEW, go to Tools»Shared Variable»Variable Manager
  2. Add a RT system to monitor by right-clicking RT Systems
  3. Right-click the library you wish to undeploy and select Remove Library

You can also deploy the shared variables programmatically from the host PC to the real-time target using the Application invoke node:
  1. Right-click the block diagram to bring up the programming palette and go to Programming»Application Control and place the Invoke Node on the block diagram
  2. Using the hand tool, click Method and select Library»Deploy Library


  3. Use the Path input of the Deploy Library invoke node to point to the libraries containing your shared variables. Also specify the IP address of the real-time target using the Target IP Address input
Note: For all the cases discussed here, the system needs time to deploy the libraries, this is why you have to place a delay between the deployment and the first access to your variable(s).

Related Links:

Developer Zone Tutorial: Using the LabVIEW Shared Variable
KnowledgeBase 3S8AETIH : Troubleshooting Network-Published Shared Variables
Developer Zone Tutorial:  Using Shared Variables in Executables



Attachments:



Deploy_LibraryVI.jpgVariableManager.jpgDeploy_Library.jpgEnhanced_DSC.jpg


Report Date: 02/13/2006
Last Updated: 08/09/2013
Document ID: 3UCBHM8T

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit