title: Sharing memory between modules
body: <p>I was wondering how to share some memory between different program modules - lets say, I have a main application (exe), and then some module (dll). They both link to the same static library. This static library will have some manager, that provides various services. What I would like to achieve, is to have this manager shared between all application modules, and to do this transparently during the library initialization.
  Between processes I could use shared memory, but I want this to be shared in the current process only.
  Could you think of some cross-platform way to do this? Possibly using boost libraries, if they provide some facilities to do this.</p>
  
  <p>Only solution I can think of right now, is to use shared library of the respective OS, that all other modules will link to at runtime, and have the manager saved there.</p>
  
  <p>EDIT:
  To clarify what I actually need:</p>
  
  <ol>
  <li>I need to find out, if the shared manager was already created (the answers below already provided some ways to do that)</li>
  <li>Get the pointer to the manager, if it exists, or Set the pointer somewhere to the newly created manager object.</li>
  </ol>