I'm essentially trying to follow a SO solution described here, but am running into a problem.
This is essentially what I am doing fron inside a JNI library:
handle = dlopen("/data/data/lib/my.package/lib/myLibrary.so", RTLD_LAZY);
myFunctionName = (func)dlsym(handle, "main");
(*myFunctionName)(numberOfArgs, arguments);
The problem is that the above ONLY succeeds if
System.loadLibrary("myLibrary")
is called from the same Java code invoking the JNI. But this obviously defeats the purpose of loading the library via dlopen.
All I get from LocCat is
A/libc(29472): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
What is going wrong? Is it something to do with the build parameters for myLibrary.so?