LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

inter process communication and synchronization

Hi all,

I 'm new in LV and I only know VB, C/C++ language.
My VB application launches some LV applications and I'd like to get the
results of tests executed by LV applications.
So I'd like to develop a communication between LV applications and VB
or C/C++ applications.
What's the best way in LV to make interprocess communication ???
My ideas are to use TCP/IP socket or windows messages.

Many thanks in advance for your help.

0 Kudos
Message 1 of 7
(3,982 Views)

LabVIEW has an ActiveX interface.

I have used that approach in similar situations.

Let us know what kind of timing criteria is involved and something about the nature of teh communications and we may be able to suggest other approaches.

Trying to help,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 7
(3,976 Views)
If you have the application builder, you can also create a DLL from the LabVIEW code and call it that way.
0 Kudos
Message 3 of 7
(3,972 Views)


@max_mont wrote:
Hi all,

I 'm new in LV and I only know VB, C/C++ language.
My VB application launches some LV applications and I'd like to get the
results of tests executed by LV applications.
So I'd like to develop a communication between LV applications and VB
or C/C++ applications.
What's the best way in LV to make interprocess communication ???
My ideas are to use TCP/IP socket or windows messages.

Many thanks in advance for your help.


Apart from turning your LabVIEW code into a shared library/DLL and calling it from your application as has been suggested already I would recommend to use TCP/IP. Active X is not simpler to handle but has as drawback that it will only work on Windows systems and over network only with some extra setup.

Using TCP/IP you have to do a little work in LabVIEW to develop a TCP/IP server but depending on your needs this can be quite simple. As long as you only need to support one single client connection at the same time a LabVIEW TCP/IP server as part of your applciation is really just an additional loop somehwere in your application listening for connection requests and handling whatever command is arriving.

Look for examples by searching for TCP/IP in Help->Find Examples. Look for Simple Data Client/Server and Multiple Connections Client/Server. These are all LabVIEW<->LabVIEW examples but if you have some experience with TCP/IP sockets in your other environment, creating a simple TCP/IP client in your external application is absolutely no problem.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 7
(3,965 Views)
Many thanks for your help which will be very usefull.
In fact, for the moment, I would like to get an error code when the
launched application exit.
Is there any way to do that ???

0 Kudos
Message 5 of 7
(3,953 Views)
How much overhead are we talking about by calling a DLL?
We are trying to do inter process communications from C/C++ to LabView.
Is the consensus still that TCP is the best?
We would like to be platform independant so Active X is ruled out?
I don't know much about Active X and its benefits.
0 Kudos
Message 6 of 7
(3,743 Views)


@Anders68 wrote:
How much overhead are we talking about by calling a DLL?
We are trying to do inter process communications from C/C++ to LabView.
Is the consensus still that TCP is the best?
We would like to be platform independant so Active X is ruled out?
I don't know much about Active X and its benefits.


DLL calling overhead is usually quite small. For LabVIEW DLLs there is an additional possible overhead if you work with large arrays or strings, since the memory representation for those is quite different in LabVIEW than in C, and this means that if you model your DLL interface so that it can be easily called from other languages, you will use the C types for those parameters and the LabVIEW DLL Builder will create function stubs that translate between the C type and the LabVIEW typical type, which normally involves copying the entire contents into a newly allocated memory buffer. This can for large arrays amount to a significant calling overhead. For small arrays and strings this overhead is however insignificant and for skalars it is nonexistent.

As to doing inter process communication a DLL in itself can't help you anything in that. A DLL is loaded into the adress space of the process that requested it and as such two processes loading the same DLL will result in the DLL being loaded twice into independant address locations. One instance of the DLL can not see the into global variables of the other at all.

For inter process communication there are traditionally a number of technics:

1) DDE (old, legacy and slow, Windows only)

2) shared memory (only in modern systems, very fast but only on local system and OS dependant)

3) pipes (something between shared memory and files, OS dependant)

4) files (trivial, reasonably fast, OS independant)

5) network protocol (quite fast, universal and availabel in almost any environment and programming environment nowadays, OS independant for TCP/IP).

1) should not be used anymore

2) and 3) are not natively supported in LabVIEW (well 3 is under Unix)

4) and 5) are natively in LabVIEW

Rolf Kalbermatter

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