08-31-2016 08:20 AM
I wish to read and write to shared variables from a C++ program running on a Debian machine.
I started out easy, and made a vi that takes in the ip and shared variable path as strings, and feeds them to a DataSocket Read block. It worked perfectly.
I then created a shared library (.dll) with that vi, and included it in a simple C++ application. Running this also worked perfectly.
Since my C++ program is supposed to run in a linux environment, I re-created the read vi with my Linux version of the LabVIEW Professional Development System 2015 SP1. Executing this vi also worked perfectly.
Finally I created a shared library (.so) from this vi, and tried to include it in a simple C++ application. But this time it did not work. The C++ program returns 0 (default value input into the DataSocket Read block, I guess) and the error code 42. It also causes the C++ application to crash. I have tried numerous settings when building my shared library, but nothing seems to work.
I have tried calling the shared library from LabVIEW, using a Call Library Function Node block, and this actually did work.
I am wondering if anyone has any experience in reading shared variables through a shared library on Linux?
Is there anything I could do to debug this further? I have had a quick try at using the LabVIEW debugger tool for applications and shared libraries, but I am not able to catch the application before it crashes.
I have also tried some basic valgrind testing, but there seems to be endless leaks detected, even in this simple application, so I think I might be doing it wrong.
- I have installed LabVIEW 2015 SP1 for Linux on a Debian 7.9 machine (actually an Oracle VirtualBox VM running on a Windows 7 machine).
- gcc version 4.7.2