Porting a multi-threading Delphi application to Mac: what are my choices?
Asked Answered
P

1

12

I need to port an application (written in XE2) to Mac.

My application is split into a simple UI executable (single-threaded) and an invisible engine (which heavily relies on OmniThreadLibrary 3.02 and Cromis DirectoryWatch)

Both EXEs communicate via Cromis.IPC

This is to say that I mainly have issues with these 3 components (OmniThreadLibrary, Cromis IPC & DirectoryWatch)

My focus right now is the Engine, which has most of the code.

My question is: Is there something similar to OmniThreadLibrary, Cromis DirectoryWatch & Cromis.IPC for Mac? (Whether with lazarus or XE2 with Mac as a target compiler)

The answer will help me a lot in deciding whether I should use Delphi XE2 or Lazarus (an IDE which I'm not familiar at all with) and see what's the best long term approach to offer/support both Windows & Mac with the minimum headaches

Punkah answered 13/1, 2013 at 12:7 Comment(9)
... there should be a cross-platform concurrency support library for Delphi, really ...Epilepsy
Is there much use of Delphi OSX compiler? Is it going to go the way of Kylix, or is anyone using it?Swarth
@David: we use it with great succes. Quite unlike our Kylix adventures actually ;-)Zugzwang
For IPC, you could use RemObjects, which is cross-platform. Threading libraries should port okay unless they use Windows APIs, in which case you could go back to plain TThread. Watching a directory you could do an equivalent. Sorry, no instant solution, but options.Jeanmariejeanna
@mj2008: Honestly I didn't look into OTL source code, but I tend to think it's heavily tied to Windows API (I know for sure that Cromis DirectoryWatch is). Also, I'm afraid TThread is absolutely no match for OTL, I can't even imagine using it anytime soon!Punkah
RO is a bit expensive (I mean 400 $ just for the IPC, man that hurts!), but it seems to be something to look at as a last resort, thanks!Punkah
OTL is windows only because it resorts to windows messaging and windows API to wait in a lot of places, so, for now, OTL is not an option for cross platform.Debus
https://mcmap.net/q/554637/-delphi-on-the-mac-possible-closedHeliostat
I can comment on DirectoryWatch and IPC components as I am the author of them. IPC could maybe, maybe be ported as the notion of Pipes is present on both Linux and Mac. The problem is it would still be a lot of work to abstract away from Windows API. I also do not see the benefit in case of MAC. I don't use it and don't intend to so I have no interest there. DirectoryWatch is even worse as it revolves around one single Windows specific API. I don't even know if a counterpart exists on MAC.Shortening
D
1

I am answering the part of your question dealing with compiler /IDE. I've used Lazarus and I must say that it won't take you too long to get up to speed (except for your exact requirements). Lazarus is getting more and more professional; a number of the developers are professional Delphi / XE2 coders by day. I think since you want to make your application available on Mac, you are going to have some work cut out anyway. But, it you decide to use Lazarus, you can for the most part build applications for Linux, Mac, and Windows without much effort ... most things just build right for each of the platforms from the same mostly unmodified source. Of course, as you say, your code heavily leans on OTL With OTL being a windows only library, I think you are going to have your work cut out for you. (read ... you might have to write an equivalent library yourself, or have someone do it for you) As for Chromis Directory watch, I haven't found anything yet.

I hope this helps a bit. CHEERS

This Lazarus tutorial shows that threading functionality built in. I am unaware of an equivalent library for what you are searching for. CHEERS

Desirae answered 18/1, 2013 at 20:2 Comment(6)
IMHO change OTL doesn't mean some rewriting but a entire one, since you have to change all your approach of the problem and resort to much more basic constructs, like TThread, manual data pass. Do you @happy coder really know OTL?Debus
Well, I guess I used some Canadian understatement there. I'm aware it is a big job. And no I don't know OTL, just what I've sussed out in combing the web a bit. My comment about Lazarus stands though, the fact that your particular problem may require a large re-write does not null the fact that the Lazarus environment is very approachable. CHEERS!Desirae
it's not my problem, as I'm not the OP. Your statements may be true, but remember you're first answering to the specific OP question which involves OTL, and IMHO, OTL is the main problem here and not the compiler. Cheers!! :)Debus
@jachguate, thanks for the comment. It is good advice. I've edited my response to more accurately reflect the part of the question I was focusing on. (I'm somewhat new here, so I do appreciate your comment). I didn't delete my response because it does give a good answer to the title of the posting, and anyone scanning the questions who is interested in this question will be left with something I think is useful. CHEERSDesirae
Thank you for the advice happy coder and @jachguate. I fully agree with jachguate, OTL lives in a different galaxy, far away from TThread. I found a library called Threadpool Engine, the auther indicated that he previously worked with Primoz Gabrijelcic (the author of OTL). I have no idea how good is it, but it's the only one that goes beyond TThread in FreePascal. Primoz already indicated how he felt about Delphi & Mac in a podcast sometime agoPunkah
As for Cromis.DirectoryWatch, the closest (actually the only :() thing I could find was something called inotify. If anyone knows another reference, please feel free to add it here.Punkah

© 2022 - 2024 — McMap. All rights reserved.