10-14-2015 03:39 AM
Hello,
Is there a way to reinitialize a global variable to default values during runtime?
I know how to do it by passing the vi reference during developpement but with the exe, there is no more vi:)
Best regards
10-14-2015 03:46 AM - edited 10-14-2015 03:47 AM
Hi Tapitapo,
welcome to the forum!
Instead of using a method "Reinit to default" you could just write a (default) value to your global variable.
But then you are open for RaceConditions, when there is more than one place where the global is written to…
Why not replace the global by a FGV/FunctionalGlobalVariable aka AE/ActionEngine?
Why do you think there is no global VI in your exe? It should still be there, but just inside your EXE!
10-14-2015 04:04 AM
Hello, thank you for the reply
- In case the global is modified, using a constant to initialize the global will force me to modify the vi, the "reinit to default" method no, minimum effort is better for me:)
- I use a global because it let me to be way more flexible during sql access. Only one AE will made my code a cable forest and is less modifiable, from my sight.
- The native code is embedded in the .exe after compilation of course, but there is no more vi as it is source, it is not possible to reference to the global.vi.
10-14-2015 04:16 AM
Hi Tapitapo,
I use a global because it let me to be way more flexible during sql access. Only one AE will made my code a cable forest and is less modifiable, from my sight.
There will be no "cable forest": you have an AE VI/icon where you have the global variable icon right now. The same amount of wires…
In case the global is modified, using a constant to initialize the global will force me to modify the vi, the "reinit to default" method no, minimum effort is better for me
It is just one more state of the AE. It is a one-time effort to incorporate that state in the AE.
It is even less effort to call the AE to execute that state when compared to calling the method with getting the needed reference !
The native code is embedded in the .exe after compilation of course, but there is no more vi as it is source, it is not possible to reference to the global.vi.
The "native code" is embedded in the VI: each VI is compiled while you edit it!
And you still have all the VIs in the executable…
10-15-2015 03:59 PM
You can look into config files for saving/initializing variables from an executable.