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: 

LabVIEW Error Style

Solved!
Go to solution

I'm creating a LabVIEW wrapper for a C Library. Each VI basically contains one CLFN which is configured to call a specific function of the library. What is the recommend method for wiring error in and error out terminals to the CLFN?

 

According to the documentation for CLFN is seems that wiring directly to the error in and error out terminal should be sufficient. "Error I/O operates uniquely in this function, which will not execute if an error enters the node. " [CLFN Help] If I understand that correctly it means the CLFN won't call the C function is an error is passed in. What makes me unsure is that the VI Analyzer complains when I use this wire styling.

ex2.PNG

via.png

 

When I change the wiring style to use a error case structure the error in VI analyzer goes away.

ex1.PNG

 

So should VI analyzer be ignored and I wire directly to the CLFN or should I wire to and use a error case structure?

0 Kudos
Message 1 of 4
(2,780 Views)
Solution
Accepted by topic author schddc

@schddc wrote:

I'm creating a LabVIEW wrapper for a C Library. Each VI basically contains one CLFN which is configured to call a specific function of the library. What is the recommend method for wiring error in and error out terminals to the CLFN?

 

According to the documentation for CLFN is seems that wiring directly to the error in and error out terminal should be sufficient. "Error I/O operates uniquely in this function, which will not execute if an error enters the node. " [CLFN Help] If I understand that correctly it means the CLFN won't call the C function is an error is passed in. What makes me unsure is that the VI Analyzer complains when I use this wire styling.

ex2.PNG

via.png

 

When I change the wiring style to use a error case structure the error in VI analyzer goes away.

ex1.PNG

 

So should VI analyzer be ignored and I wire directly to the CLFN or should I wire to and use a error case structure?


LabVIEW best practices says, "use the case structure".  That being said, it probably doesn't make a difference.  And that's where the issue lies.  You don't want "probably".  You want "for sure".  By using the case structure, you can be sure that that code won't be executed if there was an error previous to the running of that code.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 4
(2,755 Views)

"An End to Brainless LabVIEW Programming by Darren Nattinger"

– Darren covers 8 things that LabVIEW programmers frequently do without thinking and proposes that these things are often wrong.

https://youtu.be/LcLyl3Xtp3Y

Look at his #1 point

"All VIs need error case staructures"

time 4:17

Omar
Message 3 of 4
(2,742 Views)

Just to add what others have said.  The VI Analyzer has some code that can be used to help ignore individual tests.  It has a performance hit, and each test (at the moment) needs to be modified to support the ignore.

 

My point is that in our reuse library I can plop down a #VIA_Ignore Error Style and that VI will not fail that test.  It is handy for putting down these things to ignore those results, for VIs that have been reviewed, and are expected to fail that test.

Message 4 of 4
(2,657 Views)