Is it possible to check which shared libraries are loaded by the calling process from another shared library (.so)? I know there are command line tools for that, but is it possible to perform such a check in C++ code?
I need to somehow get the list of native shared libraries loaded by an Android application, but it doesn’t seem to be possible from a Java code.
You could use
/proc/<pid>/mapsfile or just/proc/self/mapsfor the calling process: lines that ends with ‘.so’ are for linked shared libraries. It’s a hack, but should work. Note that one library could be mapped multiple times so you need to skip the repetitions.And good news: you could do it from java. The code snippet below prints shared libraries for the current process to the logcat.
The output on my device is:
Also if necessary pid could be obtained by
android.os.Process.myPid().