Continuing the theme about "True Native Crossplatform Delphi Library"
Continuing the theme about "True Native Crossplatform Delphi Library"
During the development of my framework. I ran into serious limitations in Delphi - Android bridge. Namely, in limiting the number of simultaneously used classes (~30-40).
What does it mean for developers?
It means, that you cannot use in your android application more that ~30-40 classes in the same time. Once you exceed this limit, your app will fall in different places on the Delphi side.
However it doesn't limits on instance count, which are allocated from one class. In other words, you can create alot of object java instances of one class, but you cannot create by one object of a lot of java classes. Since FMX is not very integrated with the native API, this issue while it is not critical. Because you are "in a bounce of limit". However, if you want to limit yourself to just Delphi with a functionality, and still use the android api directly, it can become a very serious problem in future.
As you know, for a native library, this limit is quite a serious problem. Because native Libs is tight integration with the native API and is used by a large variety of classes. This problem I faced when I started to extend the set of native components in my library. And as soon as I have exceeded the limit on the number of classes to be used, the application began to fall with crash.
After researching the problem, I realized that the problem is only on the side of the implementation of the top of the bridge in Delphi. So I switched to connecting the project to implement alternative Java bridge. The development took me one month and was a success. After the transfer the "True Native Delphi Crossplatform Library" on the new bridge, the problems went away.
All the details of the new bridge, I'll tell you later. I just want to mention that from the point of view of the developer, it can use Android API in the same way as conventional Delphi objects. Now you do not need to write:
TJView.JavaClass.Init(Context)
and can write simply in delphi style:
TJView.Create(Context)
Of the other possibilities, it will support Delphi strings as arguments to the Java API. And you will not need to perform endless conversion
StringToJString and Vice versa.
My bridge includes 2 parts:
1. Base for binding delphi wrappers and java classes
2. Special command line tools generator wich can create for you interesting delphi wrappers
I will tell you about it more detail later. Below screenshot of generated delphi wrapper for java.lang.Boolean object.
/sub
ReplyDeleteSub
ReplyDelete/sub
ReplyDeleteSounds great
/keep_us_posted
ReplyDelete/sub
ReplyDelete/sub
ReplyDelete/sub
ReplyDelete/sub o.O
ReplyDelete/sub
ReplyDelete/you-are-a-hero!
ReplyDelete/sub
ReplyDeleteToday's good news. Wish you success!
ReplyDelete/sub
ReplyDeleteCool stuff. Is the bridge will be only part of framework or it is in-depended project ?
ReplyDelete/interested
ReplyDeleteI'm really puzzled reading that Delphi Android projects are limited to 30-40 simultaneously used classes... and more puzzled when seeing how you solved this...
ReplyDelete/sub.
ReplyDelete/sub
ReplyDeleteYaroslav Brovin please, could you expand the current Delphi - Java bridge limitation? Interested on knowing how it could be fixed. Thanks in advance :)
ReplyDeleteStéphane Wierzbicki I will provide more information about it in the next week.
ReplyDeleteYaroslav Brovin You made us very anxious :)
ReplyDeleteYaroslav Brovin yes please ! I'm really interested about it
ReplyDeleteHorácio Filho Unfortunately limitation of current bridge depends on implementation which uses delphi interfaces and delphi slots for it. And there are no any fixes only as rewriting it on not using delphi slots.
ReplyDeleteYaroslav Brovin Have you rewritten the bridge for Objective-C as well? Some known limitation for it? Thanks in advance :)
ReplyDelete/interested
ReplyDelete/interested /sub
ReplyDeleteHorácio Filho not yet, I haven't research limitation on iOS bridge, but i will do it later (I guess there are the same architecture)
ReplyDeleteYaroslav Brovin You are incredible, you have done a huge work on just one month :O It is amazing, congratulations :)
ReplyDeleteYaroslav Brovin Please, let us know the problems in details :) Thanks in advance.
ReplyDeleteIt's a sample project, which shows a problem of limitation: yadi.sk - JavaBridgeLimitationDemo.zip You can check it.
ReplyDeleteYaroslav Brovin Thanks a lot :) Pretty appreciated.
ReplyDeleteYaroslav Brovin I would love to know if you have a idea about how to represent Objective-C's optional methods in the same object-oriented way you have used for the Java bridge. Thanks in advance :)
ReplyDelete/sub
ReplyDeleteYaroslav Brovin, would be great to give credit to the one that told you about this issue and explained it to you. A simple reference would be nice 😄
ReplyDeleteJose Leon Yes, sure, I wasn't be sure about is it ok or not from law side. He give me approve to do it and i'm glad to share him with you.
ReplyDeleteIt's a Diego Navaro, It's one of the developers of RTL team. For me it's a very highly skilled specialist, friendliest man and just a good guy. Which was a sample of good Delphi professional in Embarcadero. I'm glad to work with him in Embarcadero and glad to keep in touch after it. I found this problem by practical way. But i wasn't sure is it a problem in my code on in RTL. Diego had confirmed it. So many thanks for him.Thus, he pushed me to create my own bridge.
Horácio Filho What do you mean: do you talk about using protocols of Objective C in delphi. Or you mean using this approach (protocol) for delphi code on any platform?
ReplyDeleteYaroslav Brovin Shouldn't be a problem to mention him, he is just a former Embarcadero employee, the same as you. It's just a matter to give credit where credit's due, thanks!
ReplyDeleteYaroslav Brovin How would you bring Objective-C's optional methods to Delphi? For example, if you want to write a Objective-C bridge as well, you need to deal with the case of a method of a protocol not be implemented, and we can not represent this behavior with Delphi interfaces for example.
ReplyDeleteHorácio Filho It has already sucessfully implemented in RTL ios -delphi bridge through interfaces. Delphi doesn't have protocol syntax. So you can emulate it thour using interfaces. FMX uses this approach in several places. You just need to declare new delphi interface with part of delegate methods, which you would like to implement. Mark them with correct delphi attribute and implement it. RTL bridge will automatically dispatch invoking you methods from objective C side to you.
ReplyDeleteYaroslav Brovin I don't understand the slots problem, it's very easy increase the slot size, at least for me. Also I guess what are you doing, and I recommend you to check the size of your apk, if you are doing what I think, we saw a lot of cons, the first one was the size, remember that a Delphi android app is a so library, so smart linking is not going to improve the size. Also I don't see how are you going to register callbacks from Java to Delphi.
ReplyDeleteBest regards, I miss the thech discussions with you ;)
Yaroslav Brovin Any news on this development?
ReplyDeleteJosé Morango Hello Jose, I spent one month for creating well embedded form designer into IDE. It hasn't completed yet. But current version able to:
ReplyDelete1. Create new Delphi project type application, which uses only my new library
2. Create new delphi form designer, which doesn't use VCL or FMX designers (Like Intraweb or Unigui). It's really new designer.
3. Form designer allows drop new libraries controls to form, drag position and size. Also new designer has several minor features like showing size for draggable controls.
I'm going to present first video presentation in 2 weeks. Presentation will include full process from creating project in IDE, putting controls and launching on android device. Work will not comple in this 2 weeks. Just first milestone, which includes draft of all phases development of application.
On this development of new bridge, i pause it until i finish new designer. Bridge is finished on 90%. The rest work just clean up code and adding working with array.
https://plus.google.com/photos/...
New news available here: Delphi Developers
ReplyDeleteYaroslav Brovin waw great job , is there any happy news about this great project ?
ReplyDeleteRandy Domerk Yes, look at this post:
ReplyDeletehttps://plus.google.com/+YaroslavBrovin/posts/NB8d4KJs21A