Hi, I have generated a .so shared library using kotlin/native. I am using this .so shared library in my different android project. I am able to load the library but I am not able to call the functions, I think the methods name have to be with JNI underscore or something, is there a way to get details like method names of the .so shared library inside android project? (after we do System.loadLibrary(".so library name"))
n
natario1
06/06/2020, 3:56 PM
You have to use the CName annotation to your K/N methods:
@CName(Java_com_my_package_myMethodName)
m
Mananpoddarm
06/07/2020, 7:15 AM
and how do I call the method from my android app?
suppose my method name is
My kotlin native code
@CName(Java_com_my_package_manan)
fun hello(){
}
Now inside my android app main java class :
class {
init {
System.loadLibrary("native.so")
}
//what should I do here to call function hello from native.so?
}
Mananpoddarm
06/07/2020, 7:16 AM
btw @natario1 Thanks for the response, please do let me know about the above query.
Thanks a lot, it worked!
It has one problem though, I have imported C code of tensorflow in my kotlin/native project, I am not able to use it's methods in my android project. Do you have any idea why?