I'm writing a DLL in C and it uses some global variables.
I'm wondering what's the difference between using the static specifier or not. If I don't use it, does it mean that the variable is not going to be shared among processes using the DLL but it is going to be shared among the threads of a process? If I use it, doesn't mean that each process using the DLL is going to share the variable so I have to use some synchronization mechanism in order to avoid conflicts? And in this case, what happends with the threads of each process? Do they also share the variable?
Now suppose I want to allocate memory dinamically for a global variable during the execution of one the functions of the DLL, do I have to use GlobalAlloc, HeapAlloc or LocalAlloc, considering both cases, static and non static global variables?