From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Programmatically Deploy Shared Variable Library from Application or Development System

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI allows a user to programmatically deploy their shared variable library from a Development System and built Application. Once the Shared Variable Library and Executable are properly named, the user can easily change them to constants to remove front panel interaction.

 

Description

This VI deploys a shared variable library programmatically through the use of Property and Invoke Nodes. The Deploy Library Invoke Node deploys a library based on the provided library path. The case executed by the code is determined by the Kind property of the Application Property Node, which specifies the LabVIEW instance the VI is running in. The library path for the development case uses the current VI Path VI as a base from which to build the Shared Variable Library path. The library path for the Run-Time case is constructed by building onto the directory path of the executable.

 

Requirements

  • LabVIEW 2012 Development System (or compatible)

 

Steps to Implement or Execute Code

  1. Add the VI to your project containing the Shared Variable Library.
  2. Enter the name of the Library containing the shared variable in the Name of Shared Variable Librarystring control in the Development and Run-Time system cases.
  3. Enter the name of the Executable in the Name of Executable string control in the Run-Time System case.
  4. You can change the string controls to constants to remove front panel interaction by right clicking the control and selecting Change to Constant.

 

Additional Information or References

 

VI Snippet

1.png

 

2.png

 

 

 

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

 

National Instruments
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Todd S.
NI Employee (retired)
on

looks like one of your images is broken...

Todd S.
LabVIEW Community Manager
National Instruments
TobyHex
NI Employee (retired)
on

I can see both of the images...hmm let me check

National Instruments
Applications Engineer
lupo
Member
Member
on

Helpful hint, but in my experience...

... the "Shared Variable Library" within an  *.exe application was not accepted.

... it works if the "Shared Variable Library" *.lvlib is located in a directory (i.e. in the app. dir.)

Singhang
Member
Member
on

I am also trying to deploy a shared varaible library but  i am not able to acheive any result.

When i manually deploy library i see a pop up indicating what all varaibles i have deployed but cant see that pop up when i do programmatically. also i am getting error saying the library has not been deployed properly. can you help me on this

Ryan85
Member
Member
on

Hello,

 

I'm having an issue deploying a shared variable library programatically. I am attempting to deploy the library to a cRIO from an exe that runs on a windows PC. Everything work fine from my development system (with full LabVIEW dev), but when my customer runs the exe (from their system with LabVIEW run-time only) the invoke node errors with code: -2147467259. I haven't been able to find any helpful information when I search that error code. Any help would be greatly appreciated! Do I need to install an additional run-time module on the customer's PC to allow for variable deployment?

 

Cheers,

Ryan