Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

The Wiert Corner - irregular stream of stuff: jpluimers

$
0
0

Summary: Always try to avoid sharing .DCU files between projects.

I see a lot of projects at clients that do not have their individual DCU directories set (therefore having the DCU files in the same directory as the PAS files causing shared units to share the DCU files), or share DCU files among different projects.

Both are a very bad idea, as the compiler does not always understand when the DCU file does not match the combination of PAS file and compiler options.

The result is the occasional use of the DCU file in stead of the PAS file causing wrong code to be used, or wrong debugger information to be included.

Danny Thorpe phrased it on Stack Overflow:

Note that if two projects share a compiled unit, you will need to be careful to rebuild each project when switching between them. Changing a compiler define will not be enough for the compiler to know that it needs to recompile that unit from source in order to apply the new compiler defines. It would be best if the projects did not share the DCU, but shared only the .pas source file and output the .dcu to project-local directories.– dthorpe Mar 20 at 0:24

The above underlined is one of the first things I do on projects at new clients.

This was already the case with DOS based Turbo/Borland Pascal and Turbo Pascal for Windows. Probably also the same for FreePascal and Lazarus.

–jeroen

via delphi – Compiler Directive IF and IFEND – Stack Overflow.


Filed under: Borland Pascal, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, FreePascal, Lazarus, Pascal, Turbo Pascal

Viewing all articles
Browse latest Browse all 1725

Trending Articles