Communicate Between Multiple LabVIEW Executables Using Shared Variables

Updated Nov 6, 2023

Reported In

Software

  • LabVIEW
  • LabVIEW Application Builder Module

Issue Details

I have developed two LabVIEW executables and need to pass data between the two. I want to know how to do this using shared variables.

Solution

To communicate between multiple executable applications using shared variables, it is easiest to build both executables from the same LabVIEW project. The project should contain a distinct Build Specification for each executable.

If you want to build your executables in separate projects, you can add the same shared variable library (.lvlib) file to both projects so that both executables will reference the same variables. However, if the executables are meant to run in different computers, this method will not work; if this is your case, refer to How do I Use Shared Variables to Communicate Between Two Computers?  to learn how to connect from one executable to the other's variables.

You may use the Shared Variable API as well in order to programmatically identify and open connection to Published Shared Variables.

Additional Information

​When you use shared variables within the LabVIEW Development Environment, the shared variable libraries are automatically deployed when you run your VIs. Shared variables used in executables, however, must be explicitly deployed.

Shared variables between executables must be network-published, not single-process. The requirement for single-process shared variables to run on multiple VIs is that the VIs must be in the same application instance. However, executables are not in the same application instance even if they are in the same LabVIEW project. 

The default library destination is the Project Library that hosts the shared variable(s) within the executable. Instead, go to Source File Settings in the Build Specifications for your application, and change the shared variable library's Destination setting to Support Directory or another pre-defined directory.



For additional information, refer to the Using the LabVIEW Shared Variable White Paper in the Related Links section.