In our previous episode, Mattias Gaertner said:
Show quoted text 10 lines
> > If your project then included a new *.pas files with earlier unit search
> > path pointing to that new *.pas, it would recompile it and its *.dcu will
> > be generated inside your project's output path, thus used instead of the
> > original one in the Delphi7\Projects\Bpl path.
>
> Were it third party or components that come with Delphi that you replaced?
If only the unit implementation changes, and you don't use inlines and
you compile the unit with the same compiler flags, can this ppu be used
instead of the original?
I don't know if and how exactly this works.
Anyway, I'll just list some points that I know about the subject, maybe one of the other devels will correct any mistakes and/or enhance stuff.
* recompiling is done based on source timestamps and for .ppu's matching CRCs of the interface section.
* one ppu/dcu is not the other due to the recompile behaviour modification settings (-Ur see below), which can force "never recompile this .ppu" automatically.
* Contrary to Delphi, FPC also recompiles when it detected modified .incs
* the makefile parameter RELEASE=1 afaik also enabled -Ur and this is done for releases. So behaviour may differ between snapshot and release. God knows what 3rd party builders and the various *nix packagers do.
The recompilation behaviour is determined:
* -Ur (FPC)
* {$implicitbuild on/off} which is think is a .dpk only directive
* -Z "enable never build" dcc32 cmdline opt.
which all do the same thing, they allow to set a "don't recompile on source changes" flag to be set in the .ppu/dcu.
However it is not a matter of simply adding a feature here. Recompilation behaviour is a double edged sword:
- disable automatic recompilation (e.g. -Ur everywhere), and advanced users can not do this kind of tricks
- enable it, and all newbies "can't find unit system"
- then there is the matter of the .inc recompilation. FPC source a lot of .incs and all the names of these .inc files would be "forbidden" for users if the FPC distro was not compiled with -Ur.
Personally I don't like such schemes (also on Delphi) because while disciplined users can/may be able to make them work if they are very careful, it is totally unsupportable for general consumption.
And, as said, there are (support) consequences to disabling -Ur.