首页 > 移动平台 > 详细

[工作积累] Android dynamic library & JNI_OnLoad

时间:2015-01-07 10:42:17      阅读:289      评论:0      收藏:0      [点我收藏+]

Bionic libc doesn‘t load dependencies for current .so file (diff from Windows or Linux)

so a explicit calling of Java‘s System.loadLibrary() is needed, in order to load depedency libraries. otherwise the original .so will fail to load.

 

JNI_OnLoad will be called mostly on  System.LoadLibrary() or equavilent calls

System.loadLibrary("gnustl_shared");

 

the .so file is loaded & and symbol get loaded by common dynamic library function:

dlopen

dlsym

 

if the symbol "JNI_OnLoad" is not found in the lib, dalvik will simply do nothing, but a Debug Log: No JNI_OnLoad found in xxx.so, skipping init.

 

details at:

 dalvik/vm/Native.c

 

NatvieAcitviy: JNI_OnLoad is not get called

For the startup library speicified by "android.app.lib_name", JNI_OnLoad is not get called,

only libs loaded by System.loadLibrary() will.

[工作积累] Android dynamic library & JNI_OnLoad

原文:http://www.cnblogs.com/crazii/p/4207642.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!