Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to load a shared library without loading its dependencies?
    primarykey
    data
    text
    <p>Say I have a library <code>libfoo.so.1</code>, which depends (according to <code>ldd</code>) on <code>libbar.so.1</code>. However, <code>libbar.so.1</code> is not available at the moment. My app needs to call a function in <code>libfoo.so.1</code> which doesn't require <code>libbar.so.1</code> at all.</p> <p>Is there a way to load <code>libfoo.so.1</code>, resolve the function symbol and then call it without having <code>libbar.so.1</code> to satisfy the dependency? It's a case of "I know what I'm doing, just let me do it already". I tried the RTLD_LAZY flag, but it still tries to load the <code>libbar.so.1</code> library before <em>not</em> loading the symbols.</p> <hr> <p><em>EDIT</em></p> <p>Here's the exact situation.</p> <p>We have 3 players:</p> <ul> <li><strong><code>libbar.so.1</code></strong>, a shared library located in a path not in <code>LD_LIBRARY_PATH</code> or <code>ldconfig</code>, and whose dependencies are all resolved</li> <li><strong><code>libfoo.so.1</code></strong>, a shared library located in a different directory than <code>libbar</code>, but which depends on <code>libbar</code>. At runtime, <code>libfoo</code> will know where to locate <code>libbar</code>.</li> <li><strong><code>App</code></strong>, a binary application which needs to load <code>libfoo</code> at some point during runtime.</li> </ul> <p><code>App</code> doesn't know where to find <code>libbar</code>, but knows that <code>libfoo</code> knows. What I'm trying to accomplish is having an init function in <code>libfoo</code> which would simply change <code>App</code>'s current working directory to where <code>libbar</code> is located to finally resolve all the dependencies and make everyone happy.</p> <p><code>libfoo</code> will <em>eventually</em> need to call stuff in <code>libbar</code>, just not in this init function. I don't think creating a stub would work since the symbols would eventually need to resolve to the <em>real</em> functions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload