title: dlopen - Undefined symbol error
body: <p>I'm using dlopen to load a shared library at run time</p>
  
  <pre><code>dlopen("SharedLibarary1.so", RTLD_NOW | RTLD_GLOBAL);
  </code></pre>
  
  <p>In that shared object I refer to a const char* defined in another shared library "SharedLibarary2.so". </p>
  
  <p>The Executable, and both the libraries are built using -rdynamic.</p>
  
  <p>But I still get the run time error when using dlopen: "/usr/lib/SharedLibarary1.so: undefined symbol" and points to the mangled const char* has the undefined symbol.</p>
  
  <p>Whith GDB "info share" I can see that the second library is not loaded at the point of the error. </p>
  
  <p>How ever that problem goes away if I do a dlopen on the second library before I do on the first library.</p>
  
  <p>Is there a better way to force the loader to load the second library for the unresolved symbol?</p>