LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run a Labview dll or exe from VB for applications or VB.net and pass data between each other

Hi I would like to use VB for user interface and labview to control a set pumps using serial communication. I need to pass  the command string from VB to labview so labview can send it to the pump and get back with some values that are passed back to VB. I have to build lot of logic to run the pumps the way the we want to run them and it is easier to write that login in VB. Example code would be very helpful.

 

 

 

thank you.

 

0 Kudos
Message 1 of 3
(2,931 Views)
There are two approaches to look into. One is to build your LV code into a DLL and then call that from VB. I'm not that familiar with VB 6 but I believe there is a way to call C DLLs. I know you can do that with VB.NET.
 
The other approach to look into is the LabVIEW ActiveX Server interface. This allows you to control LV via ActiveX - you can load VI's, set their inputs, run them and get the outputs. It does require that the full version of LV be installed. It also means the VIs will run in another process - hence it is a bit slower to talk to them versus the DLL case.
0 Kudos
Message 2 of 3
(2,926 Views)


@Lycangeek wrote:
There are two approaches to look into. One is to build your LV code into a DLL and then call that from VB. I'm not that familiar with VB 6 but I believe there is a way to call C DLLs. I know you can do that with VB.NET.
 
The other approach to look into is the LabVIEW ActiveX Server interface. This allows you to control LV via ActiveX - you can load VI's, set their inputs, run them and get the outputs. It does require that the full version of LV be installed. It also means the VIs will run in another process - hence it is a bit slower to talk to them versus the DLL case.


VB5 and maybe 6 do not support __cdecl imports so you have to make sure that the LabVIEW DLL exports those functions as __stdcall. For the rest it is fairly simple to import functionality from a DLL into VB, you only have to watch out for pointer parameters but LabVIEW has similar complications and limitations so a LabVIEW DLL is not very likely to use parameter types not supported by VB, unless you specifically ask to use LabVIEW specific datatypes in the Application Builder setup.

Active X also has an additional problem when you want to pass large arrays from and to LabVIEW. VB then works always with SAFEARRAYS and LabVIEW has to convert them before being able to work with them.

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