LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create shared library for linux real time target in Windows labVIEW?

Solved!
Go to solution

I  am using myRIO which is running linux real-time. In my project, I need to wrap up some C code, so I tried the Call Library Function Node. 

I know I should use the linux cross-compile toolchain on Eclipse to compile the c code into the linux .so library. But the problem is that the Call Library Function Node doesn't recognize the .so file because my labVIEW is running on a Windows PC.

What should I do to fix it and how to combine C code with labVIEW when programming for embeded device like myRIO?

0 Kudos
Message 1 of 11
(5,940 Views)
Solution
Accepted by topic author 张弋

Basically you need to create also a Windows DLL which exports the same functions. These functions can be empty stubs if you don't want to run the code properly under Windows, otherwise you have to think about how to implement the equivalent functionality on the Windows API.

 

Then you can enter in your Call Library Node as library name "<your library name>.*" and name the Windows shared library "<your library name>.dll" while the Linux version is called "your library name>.so". LabVIEW will replace the * after the point in the library name with whatever is the prefered shared library extension for the platform it is running on and therefore load the right shared library.

 

Alternatively you could wrap all Call Library Nodes in a Conditional Compile structure that contains the Call Library Node in the Linux RT case and whatever you want to run on other platforms in the default case or a specific platform case.

Rolf Kalbermatter
My Blog
Message 2 of 11
(5,914 Views)

Thank you! I make it work.

0 Kudos
Message 3 of 11
(5,889 Views)

Hello,I want to use fanuc focas  in myrio. It's a third party windows dll. I failed to use the dll. So can you tell me how to use it?

0 Kudos
Message 4 of 11
(5,473 Views)

You should start a new thread for your problem rather than resurrecting an old thread.

 

The myRIO runs Linux RT, not Windows. DLLs are for Windows. *.so files are for Linux. You will need to either a) find the .so file for the library, b) recompile the library from source for linux RT or c) recreate the functionality in LabVIEW


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 5 of 11
(5,465 Views)

Thanks for your anawerSmiley Happy

0 Kudos
Message 6 of 11
(5,445 Views)

So,if fanuc system don't offer a third party .so. I have no other way to control the mechine tool with fanuc system. It's very important for me to realize the control of mechine tool.Thank you.

0 Kudos
Message 7 of 11
(5,420 Views)

How does the tool interface with the PC? You might have two options - talk to the device manufacturer and see if they have any other libraries for communicating with the device or maybe the details of a different protocol you can use (e.g. TCP/IP, MODBUS, CAN, Serial etc.).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 8 of 11
(5,412 Views)
PC connects the mechine tool with TCP/IP. But now i know waht i have to do is to create a new controller for the mechine tool. It seems impossiable.
0 Kudos
Message 9 of 11
(5,400 Views)

@小66 wrote:
PC connects the mechine tool with TCP/IP. But now i know waht i have to do is to create a new controller for the mechine tool. It seems impossiable.

Not sure what Fanuc hardware you try to access. I did deal in the past with a Fanuc robot and these use a protocol that GE Fanuc calls SRTP. However very little can be found about this protocol online. The Wiki page only references this document which is not really documenting the low level byte format over the Ethernet wire. The best openly available documentation I have found is in the LibOpenSRTP project. It's in no ways complete and leaves many things open about how to actually adres the right memory and registers for any particular operation, but it's the best I have found so far.

 

Once you have implemented the low level TCP/IP SRTP protocol (definitely preferably in LabVIEW using the TCP/IP nodes rather than using the C code to create a shared library) you have to use whatever programming tool you would normally use to control it and then using Wireshark to sniff the resulting network traffic to find the right commands to send over the wire.

 

If your machine tool doesn't use SRTP then there is probably even less of a chance to make it work from within a RIO target.

 

Another option of most TCP connected GE Fanuc devices could be Modbus TCP. There is a ready made driver for Modbus TCP to download from NI.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 11
(5,373 Views)