Complete the following steps to create and configure a shared variable.
![]() |
Note You can create, configure, and host shared variables only on Windows or RT targets with the LabVIEW Real Time Module. You can use the DataSocket VI and functions to read or write shared variables from other platforms. |
![]() |
Note If you right-click a target or a folder that is not inside a project library and select New»Variable from the shortcut menu to create a shared variable, LabVIEW creates a new project library and places the shared variable inside. |
![]() |
Note You can configure buffering only for network-published shared variables. If you publish a shared variable with less than 8 kilobytes of data, it can take up to 10 milliseconds for LabVIEW to send that data over the network. The Flush Shared Variable Data VI allows you to flush the buffer immediately and eliminate this delay. |
You also can bind the new shared variable to an existing shared variable or to an NI Publish-Subscribe Protocol (NI-PSP) data item.
You also can use the NI Distributed System Manager to edit, create, and monitor shared variables outside of the project environment. However, if you deploy a LabVIEW project library that includes shared variables and then use the System Manager to create new shared variables in the same project library, the new shared variables exist only until you deploy the project library again.
If you have RT, FPGA, DSC, or an Embedded module installed, Change to Shared Variable Node appears as a new option in the shortcut menu when you right-click a control, indicator, or constant. You also can select Create»Shared Variable Node from the shortcut menu when you right-click an output terminal.
You also can use the Variable Reference property with the Variable properties to configure shared variables programmatically.
![]() |
Note You can create shared variables outside of a project library using the VI Server methods. To correct errors you might experience because the shared variable is not in a project library, you can use the AddSharedVariableToLibrary VI in the labview\vi.lib\Utility\Variable directory to programmatically add shared variables to a library. You also can use the CreateOrAddLibrary polymorphic VI to programmatically add a library to a project or a parent item such as a target, folder, or another library. |