How to hide a global variable, which is visible across multiple files?
问题 I am writing a C (shared) library. It started out as a single translation unit, in which I could define a couple of static global variables, to be hidden from external modules. Now that the library has grown, I want to break the module into a couple of smaller source files. The problem is that now I have two options for the mentioned globals: Have private copies at each source file and somehow sync their values via function calls - this will get very ugly very fast. Remove the static