How to create a c++ shared library (.so) for linux real time (for myRio) with Eclipse to use in LabView?

10-11  Source: Network gathering  Views:2 

I tried already these Tutorials and Advices but I didn't find a solution:
- and some more
I want use c++ codes on linux real time. For testing reasons I want to have a function that adds 2 values and gives the result.
I've done these steps:
1. writing a c++ file in Eclipse (see screensot 2)
2. building a shared library (.so) from my c++ project in Eclipse (with Cross GCC)
3. putting this file on myRio (path: /usr/local/lib/)
4. creating a VI that calls this library from Labview with a "Call Library Function Node" (see screenshot3)
5. Setting the properties for the "Call Library Function Node" (see screenshots 4-7)
After I run this VI i get this error message: LabVIEW:  (Hex 0x627) The function name for the ... node cannot be found in the library. To correct this error, right-click the Call Library Function Node and select Configure from the shortcut menu. Then choose the correct function name. (see screenshot1)
I've tried a lot things to solve this problem but I couldn't find a solution. Would be very happy if anyone can help me. I guess that I have to edit my c++ code to export my function (symbol). But I have no idea how to make it. I also tried it with a dll file in the same folder but it didn't help.
Perhaps someone can send an example which works on myRIO.
 can see it in the screenshot8 there is a function called "_Z8AddierenddPd" instead of "Addieren". I copied this name to Labview (see screenshot9) and it worked.
I'm sure that there is a way to compile the shared folder with gcc without decorations (mangling). But I don't know how. If someone has a recommendation I would be very glad!
Prepend each function declaration that you want to be available without name decoration with
extern "C" <your function declaration>
Or if you have multiple functions you want to export you can in the header file where you declare your functions simply use:
#ifdef __cplusplus
extern "C" {
<all your function declarations>
#ifdef __cplusplus
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions
Related articles