2

We are using packages to split our code base into smaller pieces, but always deploy as a single monolitic executable.

When compiling the packages the units in a package project are linked together into .dcp and .bpl files and finally they are linked again into the executable (.exe).

This is is a bit of a time waster, I'd like Delphi to only compile the DCUs and not link them into packages.

So:

Is it possible to turn off linking for packages and only link in the final executable?

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
  • 1
    I don't understand why you have packages at all. It doesn't sound like you use them for anything. – David Heffernan Nov 27 '19 at 23:44
  • Me neither. Simply make some meaningful directory structure and put the corresponding modules (units) there. To make the module naming more clear you can use namespaces. – TLama Nov 27 '19 at 23:56
  • Your post makes no sense. If you're building a single monolithic executable, there are no packages involved -- the presence of a single package means it's no longer a single monolithic executable. If you don't want packages, then don't include packages, and the .dcus are compiled directly into the executable itself. Turn off *Link with runtime packages* in the project options (Project->Options->Packages->Runtime Packages). – Ken White Nov 28 '19 at 02:23
  • The source code has 300k lines of code in 2k files, would you put all of them into a single project? – Jens Mühlenhoff Nov 28 '19 at 10:20
  • I just tried to put them all into a single project and that kills the compiler with an out of memory error. – Jens Mühlenhoff Nov 28 '19 at 10:51
  • If you search around SO, you'll find that a number of people have Delphi projects with ten times your 300k lines without resorting to packages. Fewer, larger units might be less of a strain for the compiler. Also, even in D7, System.Pas allowed for a much larger number of units at r/time: `UnitEntryTable = array [0..9999999] of PackageUnitEntry` – MartynA Nov 28 '19 at 12:46
  • 300kloc is quite a small project – David Heffernan Nov 28 '19 at 19:39
  • You also have to take third party libries into account though, which I guess it what kills the compiler. The Compiler runs into an out of memory exception. – Jens Mühlenhoff Feb 06 '20 at 14:18

1 Answers1

1

fastdcc in IDE Fix Pack from Andreas Hausladen has a switch that does exactly this:

-x--compileonly

Output intermediate files, skip linking. 1: Output only DCU and DCP. 2: Output only DCU.

https://www.idefixpack.de/blog/ide-tools/ide-fix-pack/

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113