[fpc-devel] About building JNI library for arm-linux

Yury Sidorov jura at cp-lab.com
Mon Oct 31 22:12:39 CET 2016

On 10/31/2016 10:01 PM, Gennady Agranov wrote:
> I have an issue with loading JNI library for Raspberry :(
> I do compile with -Cg -WX and stack checking on (and also without).
> But even this method is not called :(
> function JNI_OnLoad(vm: PJavaVM; reserved: pointer): jint; {$ifdef
> linux}cdecl{$else}stdcall{$endif};
> begin
>   writeln('lll');
>   exit(0);
> end;
> Any suggestions?
> Thanks,
> Gennady
> Java HotSpot(TM) Client VM warning: You have loaded library
> /media/pi/Transcend/cypress-release/pas2jni_policing64/policing64/policing.so
> which might have disabled stack guard. The VM will try to fix the stack
> guard now.
> It's highly recommended that you fix the library with 'execstack -c
> <libfile>', or link it with '-z noexecstack'.
> [FORMS.PP] ExceptionOccurred

Why do you use LCL in your JNI library?
Try a simple library without LCL and check if it loads.
Also do not add any extra compiler switches.
In FPC 3.0 -Cg is broken for ARM.


More information about the fpc-devel mailing list