My team was hoping to take advantage of both LabVIEW and C++ this year in the form of a mixed mode. We used the tutorial here:
http://zone.ni.com/devzone/cda/tut/p/id/5694
and mastered developing shared libraries and writing wrapper functions for our C++ code.
We wanted to program our user mode in LabVIEW and use the assistance of C++ for our autonomous. We planned for our autonomous, to let LabVIEW clean up the signals from our sensors and handle the vision processing, then give these values to a call library function node containing some object oriented autonomous code we had planned for our bot. Because the call library function node is a one call per loop sort of operation, we struggled to come up with an idea for how to keep our non-primitive data types (c++ objects used in the code to represent the field and other robots on it) in memory after the call library function node finished.
At first we had the idea to let the C++ code run continuously and have it communicate through pointers. We had already had great success experimenting with using pointers and the call library function node in the past. We planned on putting the call library function node outside the LabVIEW autonomous loop with pointers to variables as the parameters. The c library function would store these pointers and start an infinite loop of reading the data LabVIEW is giving us from these pointers, executing the c++ code we wrote, and writing values for motors to other pointers provided to us as parameters of the initial call library function call. When we attempted this though, we ran into some difficulties. Calling a c function that is an infinite loop seemed to make the LabVIEW code freeze. Upon execution we would receive a message saying that the connection to the CRIO has been lost. We reconfigured the call library function node and got it working, however, there was no data coming back to our front panel or any other indication that the C++ test code was working (multiplying two pointers and storing them in another pointer. This code did work when there was no infinite loop.) and pressing the stop button in LabVIEW wouldn’t shutdown the program.
Does anyone know any way we can make this approach work or any way of keeping our objects used in the c++ code in memory after the call library function node is finished? Is there a way we can instantiate our objects inside the shared library so that the objects are already there and will stay there even after the function called has used them?