title: dlopen() error image not found
body: <p>I have software that first loads a .dylib lets call libFirst.dylib using the following command:</p>
  
  <pre><code>void* handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_GLOBAL);
  </code></pre>
  
  <p>Later on inside a function from the loaded libFirst.dylib I attempt to load another .dylib using the same command but for libSecond.dylib, the loading of this shared library gives me the following warnings in my Xcode console:</p>
  
  <pre><code>error warning: Ignored unknown object module at 0x129310 with type 0x8a8399
  
  dlerror: dlopen(/path/libSecond.dylib, 9): Library not loaded: libFirst.dylib
    Referenced from: /path/libSecond.dylib
    Reason: image not found
  </code></pre>
  
  <p>What I don't get is that its says libFirst.dylib is not loaded but I am currently inside a function from libFirst.dylib, so how can this be?</p>
  
  <p>All my paths in DYLD_LIBRARY_PATH appear correct too.</p>
  
  <p>Thanks in advance, I have been stuck on this for days.</p>