03-20-2010 10:46 AM
hello ,
i have a recording probleme when using file refnum from a vi to another
i use AE to memorize file refnum , it s ok if done all in one sequence but not if reading is done in a vi
an writing and close in another.
if a i use probes to know refnum value i have the same at moment of record that the one at reading all other actions work correctely I don't understand where is the problem ?
here my vis
Any ideas ?
Tinnitus
Solved! Go to Solution.
03-20-2010 11:57 AM - edited 03-20-2010 11:58 AM
LabVIEW refnums all have a so called garbage collection. This means the refnum is disposed off as soon as the top level VI in whose hierarchy the refnum was created/opened goes idle. Solutions are several:
1) Keep the part in which you opened the refnum active for the entire duration of when you want that object the refnum is refering to available.
2) Pass not refnums around but paths and reopen the file whenever you need to do something
2) is obvious, 1) can be achieved in many ways, but what I usually do is having the main framework which is kept always active anyhow, do the opening of refnums to be used in spawned subpanels.
03-20-2010 12:03 PM
I don't see where you are actually initializing the file refnum shift register. In vi_mem_init, the shift registers for the file refnum gets a value stored in it in the "Read File" action.
Bu in test ae config, your actions are get cluster, set cluster, get cluster (okay none of those actually use the refnum) then Write file which needs the refnum but was never set.
You talk about the Read config vi, but I don't see where you are executing that or in what order it would be relative to the test ae config vi.
03-20-2010 02:25 PM
hello,
here it just a simplified example and it is just the problem, if you replace the first call in test ae config with read , no problem.
if you lanch read config file vi then launch test ae config (with first element to get cluster) the record doesn't work.
This simulate the first call of read config file in my top level vi and the record of this file in a sub vi trying to use the refnum even if this
refnum is well stored
is it clearer ?
best regards
Tinnitus
03-21-2010 07:49 AM
sorry i forgot two files
best regards