Discussion:
global and/or shared variable help
(too old to reply)
nelg87
2008-08-15 16:10:05 UTC
Permalink
Okay so this is what I'm trying to do... I have a VI that reads some data from a microprocessor.  I need this data later on during my testing.  It's just a simple string value.  So I read the data, put it in a global variable, and access it from my other VI that needs this value.  Well this works perfectly in the development environment but once I create an executable it no longer works.   I don't understand how the global variable is "loossing" its data.  The process doesn't enable the user to read the global before setting it.  I tried to do this with a shared variable instead but it also yields the same behaviour.  I'm thinking my problem has to do with the way the global gets loaded but I used globals before without any problem.  The only difference is that everytine I used them before it has been with static data read from a file not dynamic data obtain from a device like I'm trying to do now.  I guess I can create a VI "holder" to just hold the value I want to save and call that VI to return the value when I needed.  I just thought using a variable would be easier since it's only a simple string that I want to capture.  Any thoughts....? 
nelg87
2008-08-15 16:40:17 UTC
Permalink
Okay so I just tried using a separate VI to hold the data but that doesn't work either.  I guess my problem has to do with what gets loaded into Memory at what time.  See my application spawns the different test modules (VIs) by opening a referece with their name so they run on a separate thread than the main application.  So my problem is that I call by name the VI that sets the global/shared variable and then I call by name the VI that reads that variable.  Unless I have the VI that set the variable open I can't read it.  Please help!
Loading...