I am interested about the prospects of using any C library using JNI. Particularly with Android, but I assumed this compatibility should be the same as being compatible with JNI.
Without being an original developer of some C library, I've found it confusing to know, what methods I need to register in JNI_OnLoad (https://developer.android.com/training/articles/perf-jni#native-libraries).
To progress, I figured out with the help of https://stackoverflow.com/a/4514781/4959635 to call
nm myclib.a | grep " T "
to find a list of (supposed) "exported functions". However, the nm
output may well tell other things as well.
Now my question is,
will/could/should a library work, if I wrap only the exported functions via JNI_OnLoad?
Or do I need to ensure other qualities in the library in order to guarantee that it will work with JNI?
On the other hand, I read some other discussions such as:
https://www.thecodingforums.com/threads/unsatisfiedlinkerror-when-loading-shared-lib.360242/
which suggested that having undefined symbols might mean that the C code is not structured properly for JNI.
Whereas this resource:
seems to suggest that wrapping exported functions is in fact what's expected.