From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting LabVIEW vi output into C++

Hello all,

 

I am very new to LabVIEW programming. But, I have an old DC Source/Monitor unit , HP4141B with the different .vi files for all the functions this power source is capable of performing. 

 

I am interested in exporting these LabVIEW files as a dll and using them in a Visual C++ program. I was able to create dll files but I am not sure how to get data back from LabVIEW to be used in my C++ program.

 

For example, my labview code spits out information as 'errorOut' (this is the name of the variable in the VI output of the define VI prototype dialog box). I am wondering how to get this data back into C++ so it can be used?

 

In short, I am able to pass data to the .vi but I am not sure how to get data from the .vi to the visual C++ Program.

 

Any tips/references appreciated.

 

Thank you.

 

0 Kudos
Message 1 of 2
(2,858 Views)

First thing I'd do is look inside those VIs and see if they call a DLL - if they do, just call the DLL directly and skip LabVIEW.

 

However, if there is LabVIEW code in the VIs that you don't want to duplicate, you can build a DLL.  You can work with LabVIEW data types such as the error cluster, but it will be easier to work with simple types (numerics and strings).  For example, with the errorOut, you can unbundle the three elements (or at least the error code and the string) and make them separate indicators on the VI front panel and therefore separate function parameters.  Configure them to be outputs when you define the VI prototype.  In the C++ code, pass pointers for those parameters and let the LabVIEW code fill in the values.  You need to be a little careful with strings - make sure to allocate enough space for them before calling the LabVIEW dll - but this is all standard C programming.

0 Kudos
Message 2 of 2
(2,844 Views)