BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Minutiae (that may bite you someday)

The first bit of Minutiae illustrated some surprising results that can be obtained when comparing flattened objects:

SurprisingValues2.png

 

Now, a new bit, also dealing with flattened values and the Equality ("Equals?") Operator :

 

ReferenceObjectVsReferenceValue.png

 

In this snippet, a reference to "This VI" is compared against another reference, which also points to "This VI", but has a different Refnum (the hex value, when probing or flattening to string is different). The result of each Equality Comparison is not necessarily surprising, as long as you understand how the "Equal?" operator works in the context of comparing Refnums.

 

Instead of simply comparing the hex value of the Refnum, the comparison operator is overloaded to evaluate whether the objects to which the references point are indeed the same object. As shown below, two Refnums can have different Refnum values yet be "Equal" to each other. Simple!

 

ReferenceObjectVsReferenceValueFP.png

 

One of the most important take-aways here: visually inspecting probes to determine equality is not necessarily sufficient! Although the refnums may be different, they could still be referring to the same object (see below):

 

ProbingRefs.png

Message 61 of 131
(12,767 Views)

@JackDunaway wrote:

Instead of simply comparing the hex value of the Refnum, the comparison operator is overloaded to evaluate whether the objects to which the references point are indeed the same object.


Which is better than the previous behavior. Before LV 8.0, the comparison was for the specific reference (at least I'm assuming that's how it was done), so comparing two references to the same thing from different sources could* output a false result.

 

 

* I say "could" because sometimes it would work (I'm guessing that in those cases the reference had the same value even though it was obtained from different sources) and other times it didn't.


___________________
Try to take over the world!
0 Kudos
Message 62 of 131
(12,761 Views)

First I want to thank Yair for pointing me at Stephen's blog found here where I quote;

 

 


 

 A rumor has reached my ears. A false rumor about LabVIEW, inlining subVIs and buffer allocations. A rumor in need of quashing.

 


 

If you want to discuss this issue please started a new thread and link it back here. We don't want to foul this thread with what could be quite a "rat-hole".

 

Keeping you updated,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 63 of 131
(12,714 Views)

@Ben wrote:

First I want to thank Yair for pointing me at Stephen's blog found here where I quote;

 

 


LabVIEW Field Journal is worthy of a spot in your RSS reader. 

 

About [them]

The National Instruments Field Architects are a small, elite group of LabVIEW experts. We help your engineers become more proficient in LabVIEW. We guide software architectures, develop technical leaders, and teach and encourage good software engineering.

 

Each of the NI Field Architects has a minimum of twenty years of industry experience.

 

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 64 of 131
(12,711 Views)

I knew this and STILL bit myself

Inrange and coerce is inclusive of the upper and lower limit regaurdless of configuration properties if the limits are integer data types DUH! <face-palm>


"Should be" isn't "Is" -Jay
Message 65 of 131
(12,678 Views)

I don't recall this being added previously (please forgive if this is a repeat).

 

Removing events from a dynamic event registration node can scramble your events so add comments before changing the evnt registrations, see here.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 66 of 131
(12,636 Views)

Here is one with serial IO. I remembered it from years ago but it still appears to be biting people. The original discussion is here.

 

The gist of it is that you have to set a value in a property node as well as turning termination characters off in order to turn termination characters off.

 

LabVIEW Serial Help.jpg

 

So to turn off the termination character, set Term Char Enable to false AND set ASRL End In to 0.

 

Rob

Message 67 of 131
(12,551 Views)

This bit me once.

PaulG.

LabVIEW versions 5.0 - 2020

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 68 of 131
(12,546 Views)

Scrutinize the VI tree for legacy vi.lib functions if you build executables. Look for filenames containing "compat" or LLBs named "oldvers"

 

I have a four year old stand-alone application that uses a plugin architecture. The plugins used are standalone VIs that store common test data into a specific repository. In one plugin, I needed to store data in a reloadable format in the event that the repository was off-line. I chose XML and TRIED to use the NI "Write to XML File" function.

 

The plugin reported a 1003 runtime error. Looking at the VI, I discovered it was a polymorphic VI, it and it's instances were in an LLB that calls an unsupported VI (as noted in VI description) in another LLB with a call to another VI in the same LLB just to pop a dialog! I tried to add the various VIs to the project for my executable to no avail. NI forum searches indicate that plugins that need to use subvis (including those in user,vi and instr.lib) should be packaged as a source distribution (inside an LLB!) I finally decided to modify the "Write to XML File" instance VIs to use a native Open/Create/Replace node. I added the XML VIs to the project as dynamic and my plugin worked.

 

Lesson: Just because a VI is in the NI palette or NI folders (which we tell people to never edit) doesn't mean that it will seamlessly compile into an EXE.

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 69 of 131
(12,457 Views)

Talking to user32.dll can do cool things to integrate with Windows, like simulate keyboard and mouse commands. When you build an exe, it includes a local copy of user32.dll in the data support directory. The runtime engine checks this directory first, and so calls the wrong version of the dll causing all sorts of errors. 

 

I include the errors I encountered for anyone trying to search for info:

Access violation 0xC0000005

Procedure entry point wcscat_s could not be located in the dynamic link library ntdll.dll

 

To fix, remove the dll from the support directory before running the application. 

I may have missed an option to exclude items in a build, but I made a post-build action to remove the dll from the build directory. 

_____________________________
- Cheers, Ed
Message 70 of 131
(12,332 Views)