[fpc-pascal] JNI/Android: Java events calling pascal code

patspiper patspiper at gmail.com
Thu Apr 24 01:08:28 CEST 2014

On 23/04/14 23:40, Chriss Kalogeropoulos wrote:
> The main reason is to avoid distributing extra files with the 
> application. Having just one exe or dll that can handle the "details" 
> is much better.
> I was also hoping to reuse the code in other similar projects that had 
> different listeners. For example, a barcode reader javapos driver has 
> different event signatures (different listener class), so it needs 
> different java code. It would be nice if it could be encapsulated 
> inside the pascal class instead of an external file.
> Anyway the task is doable if someone can write the java code in a 
> temporary file and invoke the compiler. If this is not possible I do 
> not know if it can be done.
> If you do not care about that then just use java glue code, it's simpler.

The preliminary good news: I am able to use java events without java 
coding (other than one fixed java bit). I have tested the java media 
player and once the song is over, the pascal event is fired successfully :)

The fixed bit of java code can handle any event with any signature from 
any object. I have some minor but time consuming hurdles/bugs to 
overcome, but once done, only pascal coding will be needed for any java 


More information about the fpc-pascal mailing list