0

In the case of Linux, if I define a 'global' variable with the keyword 'static', i.e. local to the translation unit, e.g.

static int x = 1;  
static myType Z; 

in shared library code, will this be instantiated separately for each process that uses the library? And when would its constructor be called? Does it make any difference if the object is global? My assumption is that it would be instantiated separately for each process, and that the constructor would be called as the process is started, but I've seen postings that imply otherwise. Can anyone suggest an authoritative reference on this area?

Spalteer
  • 454
  • 4
  • 11

0 Answers0