Global variable in shared library
If a shared library uses a global variable that is not exported, does each process that uses that library get a copy of that variable?
For example, in the library in the source for one of the object files:
ptr is only used within that file, which is obvious because it is static. So, what I don't understand is if there is only one copy of ptr or if there is one for each process that is using the shared library?
static struct foo * ptr;
My initial thought would be that there are indeed multiple copies but I can't seem to get a definitive answer.
Either way, there's only one copy for all threads that a single process creates, correct? So, I do need to make sure everything is thread safe, but that's another topic.
Thanks for any help.