LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How is LabView interfaced to a C++ application?

I'm working with a C++ programmer that has an application that I need to obtain data from and send the data to my LabVIEW application.  I assume that this would be a server/client relationship where I would be the client.  The C++ programmer feels that we should be able to do this by using what is called "named pipes."  I'm not sure how to approach this because I'm not an experienced programmer (which is why I use LabVIEW).
 
In case it's relevant, I also have access to LabWindows/CVI v.8.1.1.  I don't know anything about LabWindows, athough I'm willing to learn if I need to.  I have the LabWindows product available because it is part of my quarterly NI Developer Suite update.
 
I'd appreciate it if someone would steer me in the right direction by way of a knowledge base or other documentation.  I'm currently using the Professional version of LabVIEW, v.8.5 and Win XP.
 
Thanks,
Dave
0 Kudos
Message 1 of 18
(4,591 Views)
To my knowledge, LabVIEW only ships named pipe VIs on Linux. I haven't checked to see if any are available for Windows from other sources.

Alternatives would be shared memory (which would require you to also create a custom DLL for LV to use to so you could call it), TCP or UDP.
intvsteve
LabVIEW R&D
0 Kudos
Message 2 of 18
(4,585 Views)

You can use the Call Library Function node to interact with the C++ code modules, that re built as a DLL & the required functions exported.

Try searching the NI site for "Calling C++ from LabVIEW  & vice-versa, and also some other combinations...

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 18
(4,564 Views)
On Jan 11, 5:10 pm, dj143 <x...@no.email> wrote:
> I'm working with a C++ programmer that has an application that I need to obtain data from and send the data to my LabVIEW application.&nbsp; I assume that this would be a server/client relationship where I would be the client.&nbsp; The C++ programmer feels that we should be able to do this by using what is called "named pipes."&nbsp; I'm not sure how to approach this because I'm not an experienced programmer (which is why I use LabVIEW).
> &nbsp;
> In case it's relevant, I also have access to LabWindows/CVI v.8.1.1.&nbsp;&nbsp;I don't know anything about LabWindows, athough I'm willing to learn if I need to.&nbsp; I have the LabWindows product available because it is part of my quarterly NI Developer Suite update.
> &nbsp;
> I'd appreciate it if someone would steer me in the right direction by way of a knowledge base or other documentation.&nbsp; I'm currently using the Professional version of LabVIEW, v.8.5 and Win XP.
> &nbsp;
> Thanks,
> Dave

The first thing I suggest you look at to interface a Labview VI to a
DLL or Shared Library is to use a Call Library Function Node. The next
possibility is a Code Interface Node. There are also methods
available for communicating with ActiveX and .Net.

Labview does not include support for pipes on Windows. However, the
developers at OpenG have developed a pipes library for use with
Labview on Windows. See: http://wiki.openg.org/Main_Page

"Labview for Everyone" by J. Travis and J. King has a good summary of
the various methods that can used to communicate with external code.
See pages 695 to 703 for Call Library Function Node information.
Pages 823 to 831 for ActiveX and .Net information. And Pages 833 to
835 for Pipes information.

Howard
Message 4 of 18
(4,562 Views)


@dj143 wrote:
I'm working with a C++ programmer that has an application that I need to obtain data from and send the data to my LabVIEW application.  I assume that this would be a server/client relationship where I would be the client.  The C++ programmer feels that we should be able to do this by using what is called "named pipes."  I'm not sure how to approach this because I'm not an experienced programmer (which is why I use LabVIEW).
 
In case it's relevant, I also have access to LabWindows/CVI v.8.1.1.  I don't know anything about LabWindows, athough I'm willing to learn if I need to.  I have the LabWindows product available because it is part of my quarterly NI Developer Suite update.
 
I'd appreciate it if someone would steer me in the right direction by way of a knowledge base or other documentation.  I'm currently using the Professional version of LabVIEW, v.8.5 and Win XP.
 
Thanks,
Dave


As has been already suggested, I'v written a pipe library for LabVIEW for Windows and made it available at www.openg.org. It's not released and still considered beta but it seems to work for what I needed it.

As to using the Call Library Node, that would be only feasable if the C++ application would somehow offer a DLL function interface (standard C functions only) or be turned into a DLL althogether.  The Code Interface Node does not provide any advantages to the Call Library Node but has some serious disadvantages nowadays and should not be used for new developments anymore.

As to other inter-application communication the crudest would be file IO, pipe is interesting but also a bit tricky, and TCP/IP is normally my first choice if I can use it. It's a bit more work on the server side usually than using pipes but it is rock solid, very well proven and last but not least has the additional benefit to support remote communication out of the box if that need ever should arise. And for most purposes it is not slower than pipes.

Other more obscure things could be shared memory, or DDE (ouch), with the first also not being a standard LabVIEW supported technique (for some good reason actually) and the second being an old and slow legacy techique.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 5 of 18
(4,527 Views)

HI, Rolf

 

         Do you have a new version of OGpipe? I found the OGPIPE read from Pipe__ogtk.vi can't read data from Named pipe. but the OGPIPE Write To Pipe__ogtk.vi can write data to named pipe. Now I need to using named pipe communicate with a C software, control the software to do measurement then read data from this software. I have download a pipeclient form internet ,this client can send a aommand to pipe and then read string from pipe, but I don't know how to using labview to do it ,Could your give me some help? Thanks! Our company also have some labview projects for CIT NV. I'm working in philips lighting.

Download All
0 Kudos
Message 6 of 18
(3,799 Views)

@ronke wrote:

HI, Rolf

 

         Do you have a new version of OGpipe? I found the OGPIPE read from Pipe__ogtk.vi can't read data from Named pipe. but the OGPIPE Write To Pipe__ogtk.vi can write data to named pipe. Now I need to using named pipe communicate with a C software, control the software to do measurement then read data from this software. I have download a pipeclient form internet ,this client can send a aommand to pipe and then read string from pipe, but I don't know how to using labview to do it ,Could your give me some help? Thanks! Our company also have some labview projects for CIT NV. I'm working in philips lighting.


Nothing like coming to the party late. I hope that the OP has solved his problem and hasn't been waiting nearly 4 years for an answer. Anyway, thanks for posting a possible solution for people who may face this issue now.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 18
(3,778 Views)

I have to admit that I'm at the moment not very intimate with the internal workings of the OpenG pipe library. From what I can remember pipes are unidirectional entities so if you want to read and write, you have to open one pipe for each direction (under different names). I guess the shared library could have handled that internally and offer the user the option to also do bidirectional operation, but that is not what I have gone with at the time of development. The named pipe support was in fact a sorts of afterthought as I was concentrating on standard IO redirection for command line tools and there only unidirectional operation was possible.

 

So there might be a problem to use the OpenG pipe library with your specific use case at this time. I'm rather busy at the moment and don't really have much time to look deeper into this. But if it is for a specific project you have don't hesitate to contact me or our office in Hasselt to talk about possible options.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 18
(3,743 Views)

Attached is the C# cource with PipeClient and PipeServer, I saw this sourcecode using Kernel32.dll to communicate with pipe. Hope someone can solve this problem or write a dll for LabVIEW.

Download All
0 Kudos
Message 9 of 18
(3,733 Views)