I am working on a C application. The application can have multiple instances. In each instance of the application, there are 4 components. One of the four components will have a structure that needs to be made available to the other 3 components.
Multiple instances of the application (due to reasons beyond my control) will use SHARED memory for globals. So, if a global variable was to be used, the multiple instances of the application (with 4 components each) would interfere with each other via the global variable - as far as I can tell. The other way I can think of is to pass the structure to every function call. So the structure can propagate deep into the call stack.
1) Global variable - potential interference from multiple instances of application
2) Passing the struct as a parameter in EACH and EVERY function call in each component - tedious and ugly
What do you guys think? Any suggestions?. Thank you!