views:

64

answers:

1

Can Dynamic libraries have global, local and static variables in linux?

If yes, then where will each of these variables get stored in the memory?

In my view, Globals and Static will be along with the code section of the Dynamic libraries while the locals should get declared in the stack of the executable making calls to the functions of the dynamic libraries.

+2  A: 

Your view is correct (ambiguous terminology aside)... not sure what exactly you're after here.

zildjohn01
If you look at cat /proc/<pid>/mmap in linux, it gives you the memory map, i wanted to know where global, static and local variables of Dynamic Libraries will get stored?Globals and Static variables will reside above dynamic library code section in memoryLocal variables should lie in the stack of the program which called the function of the dynamic library.Please correct if my understanding is wrong?
Sashi
@Sashi, you are correct.
pierr