JNI Wrapper for Delphi and FreePascal

JNI Wrapper for Delphi and FreePascal version 2.94

Authors: Jonathan Revusky, Amine Moulay Ramdane and Salvatore Meschini.

Email: aminer68@gmail.com

Description:

This JNI Wrapper for Delphi and FreePascal provides a powerful and simplified object-oriented API for doing mixed language programming in Java and Delphi (Object Pascal language) or FreePascal. This may provide an easier and more productive way of getting Win32 and Win64 features in Java projects and integrating legacy code (at least for the Delphi or FreePascal community). Please read the readme file inside the zip file to learn more.

I have noticed that JNIWrapper for Delphi and FreePascal was not supporting returning of Strings and Arrays types from Java, so i have implemented that and i have now enhanced JNI Wrapper to be very powerful , so it's now supporting all the necessary functions and methods and much more... hope you will happy with it cause i have worked hard to bring this new 2.94 to you, it is really now a professional software of a good quality.

Also i have enhanced more JNI Wrapper and ported it to 64 bit and to both FreePascal and the Delphi XE versions and to Delphi tokyo, here is the functions that i have implemented and added:

function JstringArrayToDTStrings(jarr : JArray) : TStrings;

function JdoubleArrayToDdoubleArray(jarr : JdoubleArray) : TDdoubleArray;

function JfloatArrayToDsingleArray(jarr : JFloatArray) : TDsingleArray;

function JcharArrayToDwordArray(jarr : JCharArray) : TDwordArray;

function JbyteArrayToDshortintArray(jarr : JByteArray) : TDshortintArray;

function JshortArrayToDsmallintArray(jarr : JShortArray) : TDsmallintArray;

function JbooleanArrayToDbooleanArray(jarr : JBooleanArray) : TDbooleanArray;

And don't forget to call TJavaVM.freeRef() method from Delphi or FreePascal when you need to garbage collect and free the memory that was allocated.

I have just read the following paper:

Efficient Cooperation between Java and Native

Codes – JNI Performance Benchmark

https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.109.5174&rep=rep1&type=pdf

And it says the following:

"Benchmark Summary

As might have been expected, obtaining Java functionality from native code via JNI function calls turned out to be much slower than pure JIT-optimized Java. Nevertheless, the overhead factor rarely exceeded 30 what is acceptable in most cases as JNI functions typically take only a small part in total native method execution time. Therefore, the overall JNI performance seems to be adequate for most applications where it really have to be used."

So i think JNI Wrapper for Delphi and FreePascal is really useful, and it works on Windows (and i will perhaps soon port it to Linux), but notice in the following that the Market share of Windows is 87.67%:

https://netmarketshare.com/operating-system-market-share.aspx?options=%7B%22filter%22%3A%7B%22%24and%22%3A%5B%7B%22deviceType%22%3A%7B%22%24in%22%3A%5B%22Desktop%2Flaptop%22%5D%7D%7D%5D%7D%2C%22dateLabel%22%3A%22Trend%22%2C%22attributes%22%3A%22share%22%2C%22group%22%3A%22platform%22%2C%22sort%22%3A%7B%22share%22%3A-1%7D%2C%22id%22%3A%22platformsDesktop%22%2C%22dateInterval%22%3A%22Monthly%22%2C%22dateStart%22%3A%222019-10%22%2C%22dateEnd%22%3A%222020-09%22%2C%22segments%22%3A%22-1000%22%7D

You can go to download the zip files by clicking on the following web link:

https://drive.google.com/drive/folders/1QgF6YGiSlgB9GtSZ0NmzFdRgL2whOxSe?usp=sharing

Language: FPC Pascal v2.2.0+ / Delphi XE+: http://www.freepascal.org/

Operating Systems: Windows.