unsatisfiedlinkerror in android PVR


I have a working shared library object for my app (libApp.so) and it works just fine.

I need to interface with Java and have created a separate shared library (libTalkToJava.so) which gets loaded in java code as

Now, when I launch the app, TalkToJava gets loaded and JNI_ONLoad is callled and I also able to call my c++ functions from Java.

However I need to call functions in libApp.so from libTalkToJava. I therefore link this in TalkToJava's android.mk as

If I now compile (compiles fine with calling functions in libApp.so) and launch, I am getting unsatisfiedlinkerror when the TalkToJava is getting loaded. 
java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1963]:    82 could not load needed library 'libApp.so' for 'libTalkToJava.so' (load_library[1105]: Library 'libApp.so' not found)

How can libApp.so be not found ?? 

Can you please tell me what the problem is and how I can lload a library that is linked in the manner as described above??

mkandula2012-06-15 10:45:00

The answer for this turns out to ensure all the c++ code related to Talk2Java scoped between
extern "C" { }

Apparently the signature of the function in c++ gets changed otherwise !!!

Also if libApp.so is the "main" library, then you should ONLY load explicitly other .so's in Java code. Thus for my case, I needed to have "extern" calls from libApp.so  to libTalk2Java. 

mkandula2012-06-20 06:20:36