[fpc-pascal] ppcjvm issues

Jon Foster jon-lists at jfpossibilities.com
Thu Jan 26 22:30:14 CET 2017


On 01/18/2017 01:16 AM, Michael Schnell wrote:
> On 17.01.2017 19:07, Lars wrote:
>> If you have a jvm project with lots of code and now want to start using
>> this code in another regular mode objfpc unix/win32 application...
> Exactly this as the point I wanted to express. Even when coding an fpc 
> application or library for use with  jvm, free (and destroy) should be 
> used and provided in the normal way good old Object Pascal requires. If 
> jvm does garbage collection under the hood (and not momentarily adheres 
> to free, as we are used to with Object Pascal) this should be handled as 
> a hidden implementation detail and as little as possible be communicated 
> outside, so that using this code in another regular mode objfpc 
> unix/win32 application can be done as seamlessly as possible .

I agree for seamless compatibility "free" / "destroy" should be provided. 
As far as I can tell the JVM implementation of TObject does provide these. 
Using the native Java/Android objects is a lot like using Lazarus / Delphi 
/ TComponent based classes. You create them and whoever you specify as the 
owner frees them. In this case the JVM is freeing them. But that's not a 
detail I need concern myself with.

That said, all of the code in my project was written and tested in plain 
old native compiled code running on my Linux box. Only the UI code is 
unique to Android. As such I've not run into any problems creating and 
freeing my native FPC based components. I haven't tried freeing/destroying 
Java/Android components. I imagine its going to tell me that those methods 
don't exist on those objects, since those class libraries don't provide 
them. But maybe FPC has hidden that detail as well. When I get a moment 
I'll give it a whirl, 'cause I've had many years of training to free what I 
create. I started my Pascal journey with Delphi 1/2 in '96.

THX - Jon

-- 
Sent from my Debian Linux workstation -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
jon at jfpossibilities.com
541-410-2760
Making computers work for you!




More information about the fpc-pascal mailing list