Wednesday, April 6, 2011

Static / global variables in shared library in C language

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 ?

From stackoverflow
  • will these processes share the global variables

    No.

  • 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.

0 comments:

Post a Comment