I managed to compile and run the library for android on emulator, which I compile the project just a libhellojni.so
compile using paramater like this
ppcarm -Scghi -O1 -Parm -gl -b -B -XX -Xc -XD -CpARMv6 -CfSOFT -dandroid -vewnhi -l -XParm-linux- -Fi/home/herux/workspace/hellojni/jni/lib/arm-linux/ -Fu. -FUlib/arm-linux/ -o../libs/armeabi/libhellojni.so -FD/usr/share/fpcsrc/binutils/ hellojni.lpr
on Kubuntu 10.04 x86_64
library code:
library hellojni;
{$ ifdef fpc}
{$ mode delphi}
{$ endif}
uses
JNI, log;
Java_com_herux_hellojni_MainActivity_Hellojni function (env: PJNIEnv; Thiz: jobject): jstring; cdecl;
begin
result: = env ^. NewStringUTF (env, PChar ('Hello JNI from FreePascal ..'));
end;
exports
Java_com_herux_hellojni_MainActivity_Hellojni name 'Java_com_herux_hellojni_MainActivity_Hellojni';
begin
end;
then I try to use classes unit or sysutils, the project succeeded in compiling, but the library did not loaded by the emulator. there is an error SIGSEGV
D/dalvikvm( 1082): Trying to load lib /data/data/com.herux.hellojni/lib/libhellojni.so 0x44e7ea48
I/DEBUG ( 31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 31): Build fingerprint: 'generic/sdk/generic/:2.2/FRF91/43546:eng/test-keys'
I/DEBUG ( 31): pid: 1082, tid: 1082 >>> com.herux.hellojni <<<
I/DEBUG ( 31): signal 11 (SIGSEGV), fault addr 7eb67b08
I/DEBUG ( 31): r0 7eb67b08 r1 7eb67b08 r2 00000000 r3 0000003d
I/DEBUG ( 31): r4 00000006 r5 809aa4cc r6 b001037c r7 00000000
I/DEBUG ( 31): r8 80813b00 r9 0000ccb0 10 4186b904 fp beb1986c
I/DEBUG ( 31): ip beb19870 sp beb19818 lr 809ab5d4 pc 809ab56c cpsr 60000010
I/DEBUG ( 31): #00 pc 000ab56c /data/data/com.herux.hellojni/lib/libhellojni.so
I/DEBUG ( 31): #01 lr 809ab5d4 /data/data/com.herux.hellojni/lib/libhellojni.so
I/DEBUG ( 31):
I/DEBUG ( 31): code around pc:
if anyone has ever experienced it? or is it a bug?
thanks
<div class="signature">-</div>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://free-pascal-general.1045716.n5.nabble.com/android-share-library-with-classes-unit-tp4297859p4297859.html">android share library with classes unit</a><br/>
Sent from the <a href="http://free-pascal-general.1045716.n5.nabble.com/">Free Pascal - General mailing list archive</a> at Nabble.com.<br/>