Is there a way to store state of dynamicall​y loaded vi without resorting to subvi tricks?

I have a VI for opening a UDP connection, retrieving data, and then closing the connection:
Setting state to 1 opens a UDP connection.
Setting state to 2 retrieves a UDP package. Most boxes above is for data manipulation.
Setting state to 3 closes the UDP connection.
Now, calling this vi as a subvi works just fine:
But, calling the vi dynamically doesn't:
The second call inside the while loop raises an error. Apparently, referenses are not valid from one call to the next when calling a dynamically loaded vi. What I need to know is, is there a convenient way around this?
Lars Melander
Uppsala Database Laboratory, Uppsala University
Solved!
Go to Solution.

Worked perfectly, thank you.
> Calling dynamically a VI inside a while loop may be pretty bad in terms of performance and I'm not sure that's a good idea.
Making the dynamic vi reentrant makes performance decent. 
Lars Melander
Uppsala Database Laboratory, Uppsala University

Similar Messages

Maybe you are looking for