NI recognizes that it is important to consider opportunities for code reuse whenever moving forward with a new project or platform. The Call Library Function Node is a LabVIEW VI that calls a DLL or shared library function directly inside your LabVIEW code. NI Linux Real-Time installs the GNU debug server on NI embedded hardware so that you can debug C and C++ shared libraries called by your LabVIEW Real-Time application.
In order to call external code from within LabVIEW on the NI Linux Real-Time operating system, the code must be compiled into a shared object file, or .so file. This is the general equivalent to a .dll in the Windows environment. NI provides C & C++ Development Tools for NI Linux Real-Time, Eclipse Edition 2017-2018 which includes the Eclipse IDE and GNU C cross-compilers for Linux. This setup can be used to perform the compilation.
The following set of instructions uses the Eclipse IDE to compile and debug the C shared library.
Figure 1. Select Shared Library in the Eclipse New Project setup wizard
The GDB debug server on the cRIO-906x, cRIO-903x, and sbRIO-9651 allows developers to debug shared library code called by a LabVIEW VI. This can be done within the Eclipse environment or using the command line and an SSH Client. Both options will be discussed here.
For some debugging steps, GDB must have access to the .so files and other information from target directories. Therefore, before you start debugging, the /usr and /usr/lib directory (or the directory contains your .so files) must be copied over to the host computer. See Step 6 under Programming in LabVIEW Real-Time above for information about how to transfer files between the host and the embedded system in Eclipse. For the rest of this document, the folder on the host you have copied these files into will be referred to as <RootFileSystemDir>.
Refer to Getting Started with C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition for basic information on using the Eclipse environment to communicate with your NI Linux Real-Time embedded system as well as information on general debugging within Eclipse.
Add the following command to Commands to execute before application: gdbserver: NNNN –attach $(pidof lvrt) (where NNNN is an available TCP port on the embedded system)
gdbserver: NNNN –attach $(pidof lvrt)
set breakpoint pending on
set sysroot <RootFileSystemDir>
Set breakpoint pending on
File C:/path to the sharedObject from Eclipse Project/libEXAMPLE.so
Set sysroot <RootFileSystemDir>
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.