2014年2月8日 星期六

[NDK] Dynamic loading share library .so 動態連接.so檔

假設libndk.so要動態連接(dynamic loading) libandroid.so

 1/ manually place libandroid.so into $PROJECT_PATH/libs/armeabi
 2/ create a new NDK shared library which source code uses "dlopen()" to load libandroid.so at runtime
 3/ create an Android.mk that uses LOCAL_LDLIBS += -ldl (ensures you can use dlopen)
 4/ build your libndk.so with the NDK build script
 5/ rebuild your apk from Eclipse or Ant, the resulting .apk should have both libraries under lib/armeabi/

沒有留言:

張貼留言