ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read / Write a Network Shared Variable from a C++ program

Hello:

 

I'm developing an application where I'm in need to modify the values of some Network Variable Engines hosted on an RT Target (an sbRIO 9632) from a C++ application developed in Visual Studio 2010. I've found in this link that the Network Variable API may be the best option for doing this. However that post is about 3 years old, and I wanted to be sure that no better option is available now. I've searched for a while, but I've been unable to find something else.

 

Can someone tell me if this is still the best method to do what I have to? Has somebody performed some tests with it? Is there any new method?

 

Thank you in advance.



Robst - CLD

Using LabVIEW since version 7.0


0 Kudos
Message 1 of 3
(5,363 Views)

Hello Robst,

Thanks for using the NI forums! The only official way to access variables between different platforms is via a DLL. A Network Shared Variable/Shared Variable is a NI technology and uses a proprietary network protocol and unfortunately it cannot be accessed so easily to its content other than with LabVIEW, LabWindows/CVI or an NI product. Maybe there are other open source tools that might be able to provide some access but without guarantee.

What I suggest you is to implement a TCP network solution to enable communication between your sbRIO and your C++ application.

Hope this helps!

Regards,

Luis C.

National Instruments

Ingeniería de Aplicaciones

www.ni.com/soporte

Luis CT
0 Kudos
Message 2 of 3
(5,295 Views)

Hello Luis:

 

Thank you for your reply.  Yes, I agree that using TCP/IP would be a good approach, actually we have used it in some applications. I just wanted to know if it was possible to directly communicate with NI Network Shared Variables.

 

For the prototype I'm currently developing, I used the approach suggested by user Beerman006 in the stackoverflow post I referenced to in my first post. I used the Network Variable API from CVI and linked against it from MSVS2010. It worked fine after some tweaks in the VS project configuration.

 

Another approach I tried was to create a LabVIEW DLL with VIs that read/write the shared variables and reference the DLL from my C++ application. This also worked for a 32 bit environment. I could not use this approach for this prototype because the software will be a 64 bit app, and since I do not have LV 64 bit, I could not create a 64 bit DLL.

 

Best regards.



Robst - CLD

Using LabVIEW since version 7.0


0 Kudos
Message 3 of 3
(4,878 Views)