LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically called vis and LV2 style globals

I’m doing a fairly simple client server set up. To handle the communication I use the built in VI server. The server has three vis that are called from the client. All these vis then use a LV2 style global to store and share some data. This works fine in development mode but now I have had some problems when making executables out of it.
I tried to have an empty VI with no functionality as the top vi and then the three vis that does the work are added as dynamic vis. These three vis use the LV2 style global.
When I then run the application it appears to work but it seams as if the LV2 style global losses its memory if it is inactive to long: It is possible to do a add and then get I get the value back, but when I try to do the same again it as if it has forgotten all about the earlier add.
Does anyone have experience in using the combination of dynamically called vis using the vi server and LV2 style globals? Does it works? Any special tricks to consider?
I would also appreciate information on how and when LabVIEW allocates and references vis, it all seams a little to much magical black box right now. I have looked around here but can’t really seam to find anything so I guess I don’t know where to look.

Thanks pp42
0 Kudos
Message 1 of 2
(2,549 Views)
You are describing what would happen if the VI was un-loaded from memory after the writes and before the reads.
 
"Any special tricks to consider? "
 
Yes,
 
LV will load all required VI's when a top level VI is open. The hierarchy screen will show you all of this.
 
When a top level VI is unloaded all VI associated with that VI that are not required for any other VI's that are open, will be unloaded.
 
A top level VI is closed and unloaded when all references to that VI are closed.
 
It sounds like you are closing or destroying refereces before you are done using them.
 
Another factor to concider is the validity of data stored in a SR of a LV2. If you have a queue reference stored in a VI that goes idle, ie not running, the resources for that entity are subject to LV "cleaning up" and closing references that may otherwise go unclosed. This is a good thing, but must be concidered.
 
So...
 
Open at the start, keep open, close when you are done. Do not store data in a VI that goes idle.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 2
(2,535 Views)