LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW 2016 - Generating C code from vi

Solved!
Go to solution

I want to analyze in data processing algorithms supplied by a contractor as vi files, 2016 format. Beside viewing the vi hierarchy, it would be very helpful if I could generate C code from the vi format for a more detailed analysis.  I see there is the LVCGenerator2015 for LabView 2015 for generating C code, but I cannot find the corresponding package for LabVIEW 2016. LabVIEW 2015 is not "forward compatible" in the respect. Is there any other options for my purpose?

0 Kudos
Message 1 of 10
(5,265 Views)

Hi gschiavone,

 

call your local NI representative for this topic.

Ask him/her about LabVIEW to C conversion…

 

General answer: yes, there is a tool to convert LabVIEW VIs to C code. But it's expensive AFAIK - maybe too expensive for just analyzing some vendor supplied code…

What exactly do you want to analyze?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(5,215 Views)

Data is collected from multiple sensors though cRIO, then post-processed under Windows. I need to analyze the post-processing computer vision algorithms that were provided by the contractor.

0 Kudos
Message 3 of 10
(5,156 Views)

Can't you ask the contractor to describe the algorithms in pseudocode?

Message 4 of 10
(5,151 Views)

I would still follow The advice of GerdW but I would suspect that even if it did did see The generated C code it would just go to vision dlls for any of the interesting parts. What exactly are you looking to get out of this analysis? From the little I know about the C code generator this doesn't seem like a typical use case.

Matt J | National Instruments | CLA
0 Kudos
Message 5 of 10
(5,148 Views)

Others have already told you more or less the same. The C code generator, as impressive as it is from a comuter programming viewpoint is most likely not what you want to do.

Aside from the exorbitant price (last time I checked) that makes it most likely a complete nogo for your intentions, there is the issue that the machine generated code is anything but your typical programmer written code. It is machine readable (a C compiler can process it) but hardly human readable. And as someone else said, it most likely will call lots of external code library functions to do the really hard parts of the code.

Unless you don't understand a LabVIEW diagram at all, I'm almost certain that analyzing the LabVIEW diagram directly is a much more straightforward approach than converting everything into C code and trying to understand that code in any way.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 10
(5,115 Views)
Solution
Accepted by topic author gschiavone

If you have the LV2015 tool, you can probably ask the supplier to downsave in 2015 format (i assume 2016 can save in 2015 format). There might be some artifacts and it might not be able to run, but for your goal it shouldn't matter.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 7 of 10
(5,094 Views)

@Yamaeda wrote:

If you have the LV2015 tool, you can probably ask the supplier to downsave in 2015 format (i assume 2016 can save in 2015 format). There might be some artifacts and it might not be able to run, but for your goal it shouldn't matter.

/Y


I'm not sure how that would help. The OP probably does own LabVIEW 2016 already but was looking for the 2016 compatible C converter. So he could do the downgrade to LabVIEW 2015 himself and then install 2015 with the C converter. However as pointed out already, the resulting code is most likely rather unsuitable to do an algorithme review at all and that together with the pretty high cost of the C converter would seem like a definitive KO for this approach.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 10
(5,088 Views)

I recall having to slog through machine generated C from good old "f2c" back in the day, difficult but not impossible. My review is limited to a small part of the code, so as long as the library functions are well-documented I will give this a try with some hope for results.

0 Kudos
Message 9 of 10
(5,083 Views)

f2c sounds like Fortran to C. Both of these are procedural programming languages so their programming paradigma is fairly similar and translation from Fortran to C isn't such a big task. LabVIEW on the other hand is a dataflow based language.

 

Translating that into C without creating race conditions and other hairy programming problems is a non-trivial task to say the least. Accordingly the generated C(++) code is not at all optimized for human readability but for correct code execution. With the necessary extra indirections and complications to make this task at all managable.

Rolf Kalbermatter
My Blog
Message 10 of 10
(5,081 Views)