[fpc-pascal] JNI/Android: Java events calling pascal code
patspiper at gmail.com
Wed Apr 23 13:33:32 CEST 2014
On 23/04/14 13:20, Chriss Kalogeropoulos wrote:
> Hello everyone,
> a couple years ago i tried the same thing. The task was to implement a
> JavaPOS driver handler from Delphi/FPC code.
> The actual driver was implemented in C++ and it used a Java interface.
> My code was the glue between the application (Delphi/FPC) and the
> driver, it had to hook the events and call the appropriate methods for
> printing etc (it was a POS printer driver).
> I found that the only way to hook a native implemented listener to the
> java class was either to write a small piece of code in java to do the
> dispatching to my code OR use dynamic compilation to create the Java
> byte code. Basically i had to write the java code inside my dll (in a
> constact string) and pass this to the Java compiler to create the byte
> code in memory.
> This needed a lot of work and i dropped it since the actual java code
> was less than 30 lines and it was very generic, so it was not worth
> the effort.
> Check this
> This needs Java 6 (which was not an option in my case, i had to use
> older versions). It might help you.
> Also it needs to store the source files locally otherwise more dynamic
> class generation will be needed.
> The link above has the info you need.
If the java code is static, why would one need dynamic compilation?
More information about the fpc-pascal