#1 2022-11-15 16:42:11

ThomasKalten
Member
Registered: 2022-11-15
Posts: 4

mORMot on Android with Delphi

Hi,

I ported mORMot to Delphi for Android.
It is surely not perfect and not yet tested very much.
Also a bad hack, which is part of mORMots remote call mechanismen, is not portable without the same hacking knowledge about the delphi android compiler.
But this feature is not used in our projects...
In the next step I will only test and verify the functions we use in our projects.

You find the adapted version on github - besides my changes it us uptodate.
   https://github.com/ThomasKalten/mORMot

Delphi version used: XE11.

Have fun.
Thomas

Offline

#2 2022-12-05 10:56:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: mORMot on Android with Delphi

Wow. This is a lot of work!
Not a bad hack at all.

The comparison is very interesting to look at:
https://github.com/synopse/mORMot/compa … Mot:master

Which features do you use? Are they stable enough?

About the remote call asm, you could reuse the very same from FPC, because the ABI (i.e. the raw calling convention) is the same with Delphi or FPC: my guess is that it is platform-specific, no compiler-specific.

Sadly, it is not stable/complete enough to be merged in mORMot 1.
And I don't have a recent Delphi for Android compiler.

But my guess is that it could be much easier and safer to add Delphi for Android support in mORMot 2.
The OS-specific code is well circumvented, in some units only.
Perhaps someone could use your great work as reference to start the mORMot 2 integration.

Thanks a lot for sharing!
- and sorry for the late answer.

Offline

#3 2022-12-05 11:23:29

ThomasKalten
Member
Registered: 2022-11-15
Posts: 4

Re: mORMot on Android with Delphi

Features we use:
  - ORM with a local database
  - the testing of this feature is in an early state

Current problem solved - not commited yet:
- dynamic sqlite loading - don't know if Delphi can use a static linked version in Android
- you have to distribute a sqlite.so lib with you app.

Important restriction for Delphi on Android: asm not supported at all
- if somebody has more detailed knowledge of the Delphi-Linker, it may be a solution to link a some precompiled lib, which contains the needed code.

Concerning OS-specific code:
- I touched mostly the parts, where some os-specific code was already in place.

Viele Grüße
Thomas

Offline

#4 2022-12-05 13:15:25

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: mORMot on Android with Delphi

Thanks for the input.

We can link some static .o with Delphi for Android - it is what the RTL does.
Especially since there is no asm available sad

My guess is that we could try to link the FPC static libs with Delphi for Android.
It "should work", since the LLVM linker can link our .o files.

You are right: we need some basic asm for the SOA calls stubs...
One solution may be to generate a very small stand-alone FPC unit, containing only the asm..end needed with no dependency at all, then use directly the compiled .o - it should work directly.

Offline

#5 2022-12-05 13:36:07

ThomasKalten
Member
Registered: 2022-11-15
Posts: 4

Re: mORMot on Android with Delphi

Thanks for the input.
So if we are already in the topic of asm, here another remark:

Another problem are the RCU128, RCU64, ... thread safe assignments.
The Delphi-Atomic-Operation give a "bus error".

Therefor the FPC solution and using a lib could also be the way out.

Offline

#6 2022-12-05 15:02:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: mORMot on Android with Delphi

Delphi seems to have some intrinsic to replace the FPC ReadBarrier intrinsic:
https://docwiki.embarcadero.com/Librari … oryBarrier

Offline

#7 2022-12-06 08:07:48

ThomasKalten
Member
Registered: 2022-11-15
Posts: 4

Re: mORMot on Android with Delphi

Thanks, I did not found this function until now.
The next detail problem solved. :-)

Offline

Board footer

Powered by FluxBB