01-30-2004 11:12 AM
02-01-2004
02:48 PM
- last edited on
12-11-2024
08:55 AM
by
Content Cleaner
Hi Steve,
Sorry no master, just Ben.
Interesting question. I put together the attached VI to see if I could answer this Q for myself.
The bottom line depends...
If you want your VI to play nice and be usable as a dynamic VI called from a bigger badder VI TestStand, etc. you should close the reference.
When you invoke the close FP method that closes the FP, Yes.
If that VI is the only VI in memory and you exit LV, then get cleaned-up in your behalf when LV exits. In this case it is not required to lose the reference, but,
"Flame suit on"
It is concidered bad style.
"flame suit off"
If you trying running the LV7 demo I posted and open another new VI, then look at the VI hiarchy screen you will see what I mean.
The demo I posted uses an event structure with a case structure in the timeout event case. This case lets you determine from a front panel boolean if the code executes an invoke node close FP. After the invoke node there is a seq structure that drives a boolean indicator to let you know the code following the invoke node does execute.
The example also lets you experiment with close the VI ref. If you run the example and allow all of the references to be closed, then a front panel close event will close the VI and un-load it from memory. Closing a VI ref can be thought of as being an official way of telling LV "I do not care about this VI any more, unload it no no else cares either". If you le tthe demo loop a couple of times opening ref to itself and then start shutting down the refs, you will see that VI will say in memory.
The example also shows that you can set up an event case that will fire on the close FP event giving you the ability to abort the operation programaticly. This demonstrates that the can run well beyond the close FP.
The demo also illustrates DR VI's rule "if the refnum changes, close it" by type casting the ref's as an array of I32's.
Summarizing:
IF this is a top level "quicky" VI you do not HAVE to close the reference. You can get away with just the invoke node close FP.
If you want to write re-usable code that will load and unload in a predictable manner, close the ref.
Sorry about the rambling, I hope this makes sense,
Ben
Ben Rayner
Certified LabVIEW Developer
www.DSAutomation.com
02-04-2004 02:31 PM
02-04-2004
02:43 PM
- last edited on
12-11-2024
08:55 AM
by
Content Cleaner
"I've just been playing it safe and closing all references"
Good go! Someone will benefit by this appraoch. It may even be you.
Thanks for the kind words.
Ben
Ben Rayner
Certified LabVIEW Developer
www.DSAutomation.com