title: Can shared library call another shared library?
body: <p>Can one shared library load and call functions from another shared library?</p>
  <p>I have Shared library <strong>libDsmTestLib.so</strong> that use another shared libraries <strong>libDsmShared.so</strong> and <strong>libPINDsmShared.so</strong></p>
  <pre><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  
  LOCAL_MODULE           := DsmTestLib
  LOCAL_SRC_FILES        := DSM_Library.cpp
  
  LOCAL_LDLIBS := -lDsmShared
  LOCAL_LDLIBS += -lPINDsmShared
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  <p>when I create <strong>libDsmTestLib.so</strong> and want to use it in my android java application like this:</p>
  <pre><code>package com.dsm;
  
  import android.app.Activity;
  import android.os.Bundle;
  
  public class dsmTest extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      }
        
      static {
          try {
              System.loadLibrary(&quot;DsmTestLib&quot;);
          }
          catch( UnsatisfiedLinkError e ) {
               System.err.println(&quot;Native code library failed to load.\n&quot; + e);
          }
      }  
  }
  </code></pre>
  <p>In the catch block I get error</p>
  <blockquote>
  <p>Cannot load library: link_image[1962]:
  33 could not load needed library
  'libDsmShared.so' for
  'libDsmTestLib.so'
  (load_library[1104]: Library
  'libDsmShared.so' not found)</p>
  </blockquote>
  <p>Loadlibrary function cant find library <strong>libDsmShared.so</strong> that uses my main library <strong>libDsmTestLib.so</strong>, Who can tell why ? and what can I do to solve this problem ?</p>
  <hr />
  <h3>Additional Information</h3>
  <p>I had a static library (.so written in C++) with functionality which I want to use from my Java android application, for that I create .cpp and .h files in which I call the function from the previously created library.</p>