0

Possible Duplicate:
Is global variable in a shared library / dll, shared across process

Hi stackoverflow, I have just a little question about using .so in C programming. I want to use static and global variables in a shared library. If this library is loaded and used by several processes, will these processes share the global variables (i.e. will a process be able to modify variables used by an other process)? Anyone got an idea about the behavior of these variables ?

Community
  • 1
  • 1
lioks
  • 9
  • 2
  • Duplicate - http://stackoverflow.com/questions/1979303/is-global-variable-in-a-shared-library-dll-shared-across-process – Adil Feb 25 '10 at 11:55

2 Answers2

2

will these processes share the global variables

No.

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
1

No, global variables are global inside a process. If you want to share data among processes you have to use specific IPC (inter-process communication) mechanisms.

mouviciel
  • 66,855
  • 13
  • 106
  • 140