37 comments

[ 3.6 ms ] story [ 74.7 ms ] thread
Sounds like there’s no macro support?

Edit: in that case, better target FreePascal or Lazarus.

Also no "typedef", "unsigned char", "unsigned long" support, nor apparently understanding of what "char *argv[]" means as a function parameter. So don't expect this is something you can use for arbitrary C code.

Still an interesting teaching tool, as long as the user understands it's very limited.

How does it compare to C2PAS?
Where exactly is Delphi being used nowadays?
Niche/custom desktop applications.
Mostly Windows desktop apps for specific verticals (seen many in insurance, finance etc) - albeit considered legacy.

I use it for Windows ISAPI dlls against various backend databases (mostly MS SQL Server).

The newer output however from this stack is from its cross platform and mobile features - Firemonkey (native UI and cross platform API wrapper). I haven’t used it yet but I have seen a few apps on AppStore and Play using them.

Firemonkey does not use native controls, it draws its own buttons and other controls.
FireMonkey has the ability to use native controls as an option:

http://docwiki.embarcadero.com/RADStudio/Rio/en/FireMonkey_N...

Sorry, my bad - you are 100% right. Firemonkey uses scalable vectors for UI. (It also uses native, but that's not what I had intended to say.)
No worries. It runs native, so your statement wasn't technically wrong. Just wanted to point out that it does still look and behave a bit different from using native controls. Although apparently that nowadays that depends on the host OS used.
A blog post listed some Delphi apps: https://jonlennartaasenden.wordpress.com/2014/11/06/famous-s...

On that list, I use WinRAR and BeyondCompare every day. I also see Skype but I think the client was rewritten in Electron/Javascript to be cross-platform Windows/Mac/Linux.

Not on that list is AcrylicDNS which I use as a DNS "firewall". The author provides Delphi source code for it: (https://mayakron.altervista.org/wikibase/show.php?id=Acrylic...)

The Dolphin emulator which is on the list is written in c++. Perhaps there once was a frontend in Delphi.
Delphi was one of my first interactions with programming. It was a CAD/CAM desktop application. They are still around today, but when I left they were trying to switch to C#. I have not met a lot of people. Who even know what it is.
Embarcadero has some Delphi testimonials on their website:

https://www.embarcadero.com/case-study

And the Delphi product page:

https://www.embarcadero.com/products/delphi

I'd take any marketing material with a grain of salt. Delphi was big 20 years ago and used in important projects. There are certainly stories to tell, doesn't mean it's relevant to the current decade.
Doesn't mean it's irrelevant either.
It does actually. Be wary of any system or company that has not migrated away. Delphi means very legacy and it's a career killer for any programmer.

The ecosystem had been on a strong decline for a while. The tools just to compile an application are incredibly expensive . Experienced developers have long left to other languages with more job prospects. New developers are not learning Delphi in university or anywhere.

Delphi was never 'big', it was merely different and had some interest from the 'Borland' name being attached to it. Now they're not called Borland noone gives a shit about delphi.
Nothing comes to mind developed in the last 20 years that's a good alternative to Delphi. Delphi lets you create commercial-grade software intended for a very small user base (less than 100). There's really nothing like it on the market. I imagine it's still used in many corporate in-house projects.
Another niche is control software for industrial/laboratory instruments. I know about FTIR spectroscopes, huge weaving machines or system that call you by number when you are at office, bank or post office.
I've seen it recently being used in industrial automation. The IDE is friendly to non-programmers, the generated binaries perform really well and the compilation times are very fast.

From my perspective, as a developer that uses more up-to-date tools, Delphi is not great, but it's not bad either.

I think if Delphi had been developed more it could still be the best windows desktop environment now.
My experience with Delphi-based Windows software is that they always load quickly and and most things are snappy, in contrast to most modern programs. I've always wondered if it's due the language itself, but then again modern programs run in managed environment. I guess if the same program is created using MFC they would be just as fast. Maybe if you don't have to deal with accessibility or internationalization it's possible to create such binaries in any compiled unmanaged language.
FL Studio is/was Delphi based but I got to believe that it’s been ported to c/c++ in light of the Mac version that’s now available. I know there is kylix but I can’t imagine that was the way it was ported. But maybe so. I actually maintain a Delphi app used for trucking and logistics that the company purchased the source code for. We have a vm sitting on our server farm that is hosting an image of a highly customized version of Delphi that’s our “build” server. We are going to port this to C# second half of the year. The dude made all sorts of UI snafus, like 4 way check boxes using multi color checks for security provisioning. To add insult to injury if you have any color blindness you cannot perform this task- red, violet, green and blue are the options. I don’t have any known color blindness and it’s hard for me to tell.
I think Image-Line is still using Object Pascal actually, both for the PC and the Mac version of FL Studio. They've been managing the Mac version by using Free Pascal for the compilation. They also have a fair amount of inline assembly, for the performance critical parts, and they have their own in-house GUI and widget library, which, apparently, will compile and run equally well using both Delphi and Free Pascal.

Edit: I notice that the post below says they're using Delphi for both the PC and the Mac version now... It could be a recent development. Last year there were posts on the Image-Line forums saying they were still using Free Pascal, due to the fact that Delphi (at that point) could not produce 64 bit binaries for Mac.

Delphi still cannot produce 64 bit binaries for macOS.
Does it know when to use 1-indices for accessing converted C strings vs 0-indices for other types? That seems to be one difficult thing to infer dynamically, especially for non-constants. I suppose it could just always treat C char* as dynamic arrays.

It does appear to treat C string constants as Pascal string constants, so if those are to be indexed correctly, it must be somewhat clever.

I was pleasantly surprised, does a lot of things, very useful for when it's needed.

It had one unexpected glitch:

    // C
    if (known_devices & BIT(0))

    // Pascal
    if known_devices and BIT(0 then )
Could somebody please check how it converts the following program:

    #include <stdio.h>
    
    int main()
    {
        if (((unsigned char) 255) + ((unsigned char) 255) == 510) {
            puts("yes");
        } else {
            puts("no");
        }
    }
(The code outputs "yes", and it does not rely on undefined behavior.)

In other words, I doubt that proper “conversion”, with all the C semantics, is feasible.

Typecasts seem to trip it up, it replaces the check with

    if (unsigned char then 255) + ((unsigned char) 255) = 510 then  begin
I'm not particularly familiar with Delphi, but the issue here appears to be a combination of parenthetical grouping not being picked up and the program not knowing that "unsigned char" should become "byte".

Ex:

  unsigned char a = 255;
  unsigned char b = 255;
  if ((a + b) == 510) {
      puts("yes");
  }
becomes

  unsigned char a = 255;
  unsigned char b = 255;
  if a + b then = 510 then  begin 
    WriteLn('yes');
  end; 
instead of

  var a,b: byte;
  begin
      a := 255;
      b := 255;
      if (a + b) = 510 then begin
          writeln('yes');
      end;
It's also worth noting that assuming parenthetical grouping is fixed, the C code snippet should work fine; according to the online compiler I was toying around with, Pascal uses integer type promotion.
It seems there a quite a number of people who are not that hot on C++, Qt or both.

The FreePascal guys though have put in some effort to create useable LCL interfaces (the Lazarus equivalent of Delphi's VCL) to interfaces to Qt4 and Qt5