jeyries
unread,Aug 29, 2009, 9:44:15 AM8/29/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-ndk
Hello,
I have observed that on Android, shared library are not reloaded
each time the activity is started.
The problem with that is that the static data from this library
stay in the same state and are initialized properly only on the first
time they are loaded.
For example the first time the activity is started, the shared
library is loaded and the static data are initialised to the good
value.
But on the second time the activity is started, the shared library
is not loaded and the system uses the library already loaded in
memory, therefore the static data are not initialized !
I have observed this behaviour on the 1.5 emulator, and on the
Samsung Galaxy phone, but on the HTC G2 there is no problem, the
library is reloaded each time.
What do you think of this behaviour ? is it a bug ? Are they some
workaround to force correct reloading of library ?
Regards,
Julien
=====================================
some logcat to show the problem :
**** first time ****
D/dalvikvm( 715): Trying to load lib /data/data/com.example.quake2/
lib/libquake2.so 0x499401b0
I/ActivityManager( 582): Displayed activity
com.example.quake2/.Quake2: 1905 ms
D/dalvikvm( 715): Added shared lib /data/data/com.example.quake2/lib/
libquake2.so 0x499401b0
D/dalvikvm( 715): No JNI_OnLoad found in /data/data/
com.example.quake2/lib/libquake2.so 0x499401b0
D/dalvikvm( 715): +++ not scanning '/system/lib/libwebcore.so' for
'getVersion' (wrong CL)
I/Quake2 ( 715): version : 1.0
D/dalvikvm( 715): +++ not scanning '/system/lib/libwebcore.so' for
'Quake2Test' (wrong CL)
D/quake2-jni.c( 715): init_done= 0
I/ARMAssembler( 715): generated
scanline__00000077:03010144_00000000_00000000 [ 11 ipp] (45 ins) at
[0x198c48:0x198cfc] in 2648382 ns
D/quake2-jni.c( 715): init_done= 1
**** second time ****
D/dalvikvm( 956): Trying to load lib /data/data/com.example.quake2/
lib/libquake2.so 0x49b36f60
D/dalvikvm( 956): Shared lib '/data/data/com.example.quake2/lib/
libquake2.so' already loaded in same CL 0x49b36f60
I/Quake2 ( 956): version : 1.0
D/quake2-jni.c( 956): init_done= 1
I/ActivityManager( 587): Displayed activity
com.example.quake2/.Quake2: 1253 ms
D/quake2-jni.c( 956): init_done= 1