News for hackers. Stuff that matters.
Re:Free Pascal by bloblaw on Sunday December 13, 2020 @11:11AM (#25407523)
For Windows users, just use chocolatey and run: `choco install lazarus`

...and you'll be up and running with (1) FreePascal compiler (2) Lazarus IDE (https://lazarus-ide.org) with integrated debugger and RAD (Rapid Application Development) GUI designer.

Lazarus and FPC can create high-quality native GUI's for macOS, Linux, and Windows. And many open-source 3rd party GUI components can be installed right from within the Lazarus IDE via the "Package" > "Online Package Manager" menu option.

I've been using Delphi and/or Lazarus + FPC for 15 years. It's truly the most productive way to build a GUI desktop application, and makes it extremely easy to build powerful console apps.

Re:Free Pascal by fmntf on Sunday December 13, 2020 @01:14PM (#25408662)
Sometimes I need to create a small GUI application for my Windows colleagues. Using Qt or .NET I get huge binaries/dependencies. What is the final binary size (all deps included) with your solution for a "hello world" GUI exe?
Re:Free Pascal by bloblaw on Sunday December 13, 2020 @01:41PM (#25408920)
This was written a few years ago with FPC v2.2 (latest is FPC v3.2), but generally matches my experience: https://wiki.freepascal.org/Size_Matters#Analysis_of_various...

tl;dr is that if you create a RELEASE build, should be about 2 - 5mb for a GUI app, depending on the platform. And if you run `upx` against the resulting binary, it will be even smaller.

  Win 7 x64:  
  ------------  
  - 12.3 mb == Default build      
  -  3.2 mb == Default build without debug info
  -  2.1 mb == Optimized compiler
  -  2.1 mb == Optimized compiler without debug info
  
  Ubuntu x64:  
  ------------  
  - 13.4 mb == Default build     
  -  7.5 mb == Default build without debug info
  -  4.4 mb == Optimized compiler
  -  2.7 mb == Optimized compiler without debug info
Optimized compiler means:

    1. Project|Compiler Options|Code|Smart Linkable (-CX) -> Checked
    2. Project|Compiler Options|Linking|Debugging| Uncheck all except `Strip Symbols From Executable (-Xs) -> Checked`Strip Symbols From Executable (-Xs) -> Checked
    3. Project|Compiler Options|Linking|Link Style|Link Smart (-XX) -> Checked
    4. (Optional) Project|Compiler Options|Code|Optimizations|smaller rather than faster -> Checked (Warning: this might decrease performance)
Re:Free Pascal by benibela on Sunday December 13, 2020 @04:00PM (#25410219)
I get 2.1 MB win32 and 6.9 MB Ubuntu x64 with fpc 3.2

Which is rather bad. I used to use Delphi 4 and it would create 350 KB programs by default.

Which was also bad, so I sometimes used that Delphi without the GUI designer and without the VCL, using the win32 API directly, to create 50 KB programs. That is a reasonable software size. Software keeps getting worse every year

Re:Free Pascal by spapas82 on Sunday December 13, 2020 @03:21PM (#25409845)
A rather small GUI windows program with few dependencies is 1-2 MB; if you pass it through UPx (https://upx.github.io/) it will be less than 1 MB. Take a look at this program https://github.com/spapas/pdfsigner/releases/tag/v1.0 build with lazarus if you want to see how it looks like.
Re:Free Pascal by pjmlp on Sunday December 13, 2020 @12:42PM (#25408350)
A sore point for me in .NET, given that Anders was on the team, was the lack of proper AOT compilation (NGEN did not really cut it), Delphi style.

We had to wait until Windows 8 to properly get it, and still its being rebooted due to the way WinRT went, whereas it could bave been there since v1.0.

https://github.com/dotnet/designs/blob/main/accepted/2020/fo...

Re:Free Pascal by ubercow13 on Sunday December 13, 2020 @01:35PM (#25408869)
How do third party GUI components work? Are they custom drawn? And how does that work with the various supported toolkit backends of Lazarus?
Re:Free Pascal by martinrame on Sunday December 13, 2020 @06:10PM (#25411410)
It has bindings for practically everything (Win32 UI, GTK, GTk2, GTK3, QT, OSX) and also you can custom drae yours.
Re:Free Pascal by WalterGR on Sunday December 13, 2020 @04:47PM (#25410647)
It's truly the most productive way to build a GUI desktop application, and makes it extremely easy to build powerful console apps.

How does the experience compare to C#, .NET Core, and Visual Studio?

Re:Free Pascal by bloblaw on Sunday December 13, 2020 @07:37PM (#25412030)
Very closely.

The original architect of Turbo Pascal is Anders Hejlsberg (https://en.wikipedia.org/wiki/Anders_Hejlsberg), who also was recruited to Microsoft directly by Bill Gates.

Anders went on to architect J++, the .NET Framework and C#, and TypeScript.

C# is heavily influenced by Turbo Pascal / Delphi because they have the same original architect. And Lazarus + FPC are open-source implementations of the Delphi 7 IDE + Object-Pascal language (same as Delphi).

If you are at home in Visual Studio, using Lazarus will feel very familiar.

Object-Pascal is easy to learn. A great site to bookmark when learning Delphi or Lazarus + FPC is: http://www.delphibasics.co.uk/

Re:Free Pascal by 0x445442 on Sunday December 13, 2020 @02:21PM (#25409269)
Do you have any references to good examples of console apps built with FreePascal?
Re:Free Pascal by bloblaw on Sunday December 13, 2020 @05:54PM (#25411268)
A list of “famous” apps written in Delphi or Lazarus:

https://jonlennartaasenden.wordpress.com/2014/11/06/famous-s...

Re:Free Pascal by benibela on Sunday December 13, 2020 @04:42PM (#25410585)
Console apps? For the terminal?

The strength of Lazarus was creating Windows GUI apps not console apps..

But I made a console app with it: http://www.videlibri.de/xidel.html

A query language for HTML, XML, and JSON

Re:Free Pascal by 0x445442 on Sunday December 13, 2020 @07:16PM (#25411907)
Yeah I know it sounded weird but I'm not really that interested in GUI apps but I am interested in different languages. Nice project page by the way. Thanks for the link.