Marco van de Voort a écrit : > In our previous episode, Thierry Bothorel said: > >> After googling I did not found clear answers, but my understanding is >> that it is not possible to build natives libraries for Android without >> writing a completely new libc translation for bionic ? >> > > I don't fully understand. libc's are not translated into pascal. > Well,
to me more clear, when I try to compile this : > library hellojni; > > {$mode objfpc}{$H+} > > uses > //Classes > { you can add units after this } > JNI; > > {$R *.res} > > procedure Java_com_example_hellojni_HelloJni_stringFromJNI( > PEnv: PJNIEnv; > Obj: JObject); > {$IFDEF WIN32} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF} > begin > Writeln('Hello world from Freepascal!'); > end; > > exports > Java_com_example_hellojni_HelloJni_stringFromJNI; > end. I have errors in ...fpsrc/2.5.1/packages/libc/.... ... > Assembling hellojni > Compiling resource > /home/thierrybo/Sys/Lazarus.projets/Tests/JNI/Hello-jni/lib/arm-linux/hellojni.or > Linking > /home/thierrybo/Sys/Lazarus.projets/Tests/JNI/Hello-jni/hello-jni.so > /home/thierrybo/Sys/local/opt/fpc/cross/bin/arm-linux-ld: cannot find > -lpthread > hellojni.lpr(17,41) Error: Error while linking after googling, it appears android libc is not standard. Here is an excerpt aboout a patch for Mono: > This is a series of patches to add support to Mono for building against > the Android NDK [0]. Android runs the Linux kernel, but moves many > things around compared to a "normal" desktop Linux distro. > These patches are based against the mono-2-6 branch. > This second patch patches libgc so that it will properly build and link > under Android. In particular, note that Android includes pthread_*() > functions within libc, not libpthread, thus the added configure check. > * include/private/gcconfig.h: Android platforms are built atop > Linux, > don't use glibc, and uses `environ` instead of `__environ`. > * configure.in: Use AC_CHECK_LIB() to check for pthread instead of > just blindly linking to -lpthread, as Android includes pthread > support within libc and doesn't provide a separate libpthread. Thierry B _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal