Reference Design Content

Showing results for 
Search instead for 
Did you mean: 

NI Linux RT Libraries

With more NI hardware targets now running Linux RT, there are a number of new features provided by the OS that LabVIEW RT can take advantage of. The following libraries are available on the LabVIEW Tools Network, and enable new capabilities that can be leveraged when creating systems that run in Linux.


Supported versions: LabVIEW 2013 or newer.


Linux RT Inter-Process Communication


This library is designed to provide new IPC mechanisms for LabVIEW RT when running on Linux RT targets (both ARM and x64 are supported). Currently included IPC features are:


  • Shared Memory
  • POSIX Semaphores (semaphore.h)
  • POSIX Mutexes (pthread.h)
  • POSIX Conditional Variables (pthread.h)
  • POSIX Barriers (pthread.h)


With the above mechanisms, LabVIEW can transfer data and synchronize execution with parallel processes, such as parallel C/C++ applications. Shared memory enables LabVIEW to create, or open existing, shared memory instances in Linux, and then read and write the contents of this memory. Because the memory is shared between processes, any change made by one process will be seen by the other processes sharing the same memory space.


shm open.png


The POSIX items enable interactions with other processes that are using pthread objects (from LabVIEW can instantiate these objects in shared memory to enable other processes to access the same instances, which allows for synchronous execution between LabVIEW and the parallel processes. LabVIEW can also use existing objects created by the other processes.


mutex code.png


VIPM Package: NI Linux RT Inter-Process Communication

Github Source: NISystemsEngineering/LinuxRT-IPC


Linux RT Utilities


This library is designed to provide access to a few common utility-style functions, such as the reading of hardware clocks or high-resolution sleep capability, from within LabVIEW RT applications.


clock time.png


VIPM Package: NI Linux RT Utilities

Github Source: NISystemsEngineering/LinuxRTUtilities


Linux RT Errno


This library aims to make error handling easier when calling into Linux system functions via a Call Library Function Node. When an error occurs, many Linux system functions store the error number in a per-thread variable called errno, and return a value like -1 to indicate that an error occurred. When calling these functions from LabVIEW, because -1 is returned and not the error number itself, error handling becomes more difficult. Until now, the accepted workaround was to create a wrapper library that would call the C function, read the error value, and return the error value directly to LabVIEW. However, when building libraries to distribute to a large number of users, having a requirement that an extra library be installed on their RT targets complicates the process.


Instead, this library provides a number of VIs for accessing the per-thread errno variable directly from within LabVIEW. An example use case is shown below for the Linux system function close() which is used to close an open file descriptor.


close with errno.png


By giving a file descriptor of -1, which is invalid, we can force an error to occur. In the event that an error occurs, close() will return -1. In this case, we can read the current errno value for this thread and then generate a LabVIEW native error accordingly.


VIPM Package: NI Linux RT Errno

Github Source: NISystemsEngineering/LinuxRTErrno

Ryan P.
Active Participant
Active Participant

Would these also work on Linux Desktop on PXI?

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center