[fpc-pascal] Working Free Pascal android JNI example

Thomas Schatzl tom_at_work at gmx.at
Wed Aug 10 11:59:03 CEST 2011


 Hi,

 On Wed, 10 Aug 2011 11:09:26 +0200, Felipe Monteiro de Carvalho wrote:
> Hello, I am ressuscitating this ancient thread because I'd like to
> continue the talk about it =)
>
> My main doubt here is if androidprt0.as is really required, which
> would mean that I can only produce android libraries if I make 
> changes
> to the compiler.

 Note that there is no dedicated android/arm support (or any arm 
 support) for freepascal yet. In some circumstances the arm/linux stuff 
 works.

> Benjamin, couldn't one just declare the missing simbols in code? This
> would simplify things a bit.

 An improved dllprt0.as has been created since, which works fine at 
 least for arm/linux.

 However, you might want to use the hack from 
 http://mantis.freepascal.org/view.php?id=18833 on android for now. If 
 you can give me some documentation how/if argc/argv/envp are passed to a 
 shared library on android, one could see if support can be added. I 
 assume that some sort of new target may need to be added though.

 You might want to check whether proper initialization and finalization 
 is performed for those libraries correctly for arm/android. At least 
 when using dlopen and friends on arm/linux (and others) this works.

 When linking a FPC library using $LINKLIB, initialization/finalization 
 is not called on several linux platforms (ppc/ppc64/arm) or crashes 
 badly on unload at least on some linuxes (x86/amd64 on ubuntu).

>> It contains also a own JNI header port from the Android NDK, and own 
>> ARM
>> Toolchain hook binaries to inject some command line parameters to 
>> the
>> original "as" and "ld" binary calls. For "as": "--march=armv7-a
>> -mfloat-abi=softfp -mfpu=vfp3" and for "ld": "--fix-cortex-a8"
>>
>> And important FPC parameters are -CpARMv6 -CfVFPV3

 Not sure whether the as/ld issues have been fixed in the meantime.

 Hth,
 Thomas




More information about the fpc-pascal mailing list