This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What does this means: All tasks executing within a single program share a common set of global variables?

Expert 1005 points

Hello,

I found the above mentioned statement in DSP/BIOS 6 documents. I am wondering what does this mean. Does it means that if I have a global variable named GV in one task and another global variable GV in another task, they share the same memory location so if task1 changes GV, its value is changes in task2?

Is there any way that I can stop this to happen?

Regards

 

  • Mans,

    There is no concept of "global variable in one task and another global variable in another task".  There is one program running on the DSP, and it is composed of (possibly) multiple tasks.  As it is one program, all global variables go into the same common namespace.  If you declare a global variable GV then you can't declare a global variable by that same name in any other file that makes up your program, otherwise the linker will complain.

    What that statement is saying is that if you declare a global variable (in any file), all tasks will have access to that one global variable.

    Regards,

    - Rob