LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to execute something on VI exit

Hi

Is there any means of executing some code on a VI exit? There is an event case for application exit, but not for VI exit so I assume that using events is out of the question. Is there any other way of finding out that certain (maybe even re-entrant) VI finnishes running? I am using HDF5 files that need to be closed manually to avoid memory leaks. I would like to implement a method or some kind of daemon that would take care of closing files when VI that opened the file exits.
--
Tomi Maila
0 Kudos
Message 1 of 7
(3,602 Views)

If you want to do this as a seperate process your best bet is probably to register each of those VI's references with that service whenever they open the files and then you can use the VI class property Execution>>State. If you get the idle state or an error that means the VI stopped or was closed.

What I don't understand though is why not do the closing inside the VI that opens the reference. That would seem to be much more elegant and easy to understand.


___________________
Try to take over the world!
Message 2 of 7
(3,595 Views)
I would like to second tst's advice.  It has worked for me for several years of HDF5 programming in LabVIEW (some of it before the event structure existed).  There are some HDF5 specific things you can do as well.
  1. If you know that no other processes are using the HDF5 DLL you are calling, you can call H5close when you exit your application.  This will flush and close all open HDF5 references.  This is required practice in the FORTRAN API.  H5close is also useful when you have a debugging session you need to terminate that leaves open HDF5 references.
  2. If you are using HDF5 1.6.x, there is a function to enumerate the open references.  You can use this to clean up cleanly.  However, the download on ni.com is version 1.4.4, so you  may not have this option.  I have never used this, so I can't give details.
0 Kudos
Message 3 of 7
(3,573 Views)
Thanks DFgray 🙂

Referring to our old discussion about HDF5, I promised to tell you how I am doing with HDF5. I modified the NI HDF5 library to use native 64-bit references with Labview 8.0, added support for complex single, added support for files in memory and fixed some bugs I found. I could provide it here, but I don't know if NI is holding a license for it which restricts the distribution of the library.

Perhaps replys to this message should be posted to the original thread here

http://forums.ni.com/ni/board/message?board.id=170&message.id=170425


Tomi

Message Edited by Tomi M on 04-24-2006 04:32 PM

--
Tomi Maila
0 Kudos
Message 4 of 7
(3,568 Views)
We (NI) would be happy for you to post the code here.  That is in the spirit of the development community we are trying to nurture at this website.  There are two, somewhat obvious, restrictions.  We request that you not sell the modified code (as a toolkit) and that you make it clear you have modified it.  Posting it in this thread pretty much ensures both of those.  My thanks for doing so.
0 Kudos
Message 5 of 7
(3,543 Views)
Is this licensing policy stated somewhere explicitly?
--
Tomi Maila
0 Kudos
Message 6 of 7
(3,533 Views)
The Terms of Use at the bottom of this page contains this information, although in a much harder to read format.  You can also find more discussion forum specific information in the help FAQ.
0 Kudos
Message 7 of 7
(3,516 Views)