Hi everyone,
I would like to know if something similar happen to you. Well the issue is that when I declare a variable as a global one in the header file of a module with extern sometimes it loses its value. And if I declare it as static I can not access to it from other module. As far As I understand, a static variable is the same during the all of the execution of the program and it has a space of memory reserved to it. Can anyone please clarify this?
Thanks in advance.
Hello!
I experienced the same behavior, but debugging the code I could see it's not that the global variable had lost its content ... (that was my first thought)
It seems like loses its scope. It is strange in a global variable right? At the beginning of the function I can manage it properly, but later in the same function can not even compare it to a value or assign its value to another variable. Strangely, if I halt there the debug and pass the mouse over the global variable, popup values are correct. But makin the next step in debug takes no effect.
I know that the variable retains its value because if I create a dummy function call it from where it fails and doing the assignment or comparison there, works fine...
In dissasembly I can see that one of the register involved has not the correct offset, so I'm focusing in optimization levels to see if i can find out where is the problem.
Please, if anyone can help...
Thank you very much in advance.
I have the same problem, did you find a solution ?
Thread dating back 5 to 6 years.
Need to look at how you are using the variables across modules, and how other things are corrupting the data. Perhaps add watch points, or monitor the memory space so you can alert as soon as it happens and instrument your code flow to focus on the responsible portions.
Check stack depth and usage.
I find that conclusion impossible. Nobody ever actually knew what the original problem was, so there's no way to know yours is the same.