8

Starting with #Delphi #XE2 many of the new RTL units related to Vcl styles, OSX and so on, uses inc files to declare types, classes and implement code (just like the FPC does), what is the justification to do that? you can see what i mean if you inspect one of these folders (source\rtl\posix, source\rtl\posix\osx, source\rtl\sys )

2 Answers 2

5

Possibly to avoid duplicating this stuff in framework/platform specific units and without adding them to the most basic RTL units. Then again, that could also have been achieved with separate units. For type declarations that should really have been done. For implementation code I can see one reason to put it into an .inc file instead of its own unit: the code is relying on the Delphi specific rules regarding private class members (strict private was added to avoid this).

0

If one looks at the .inc files, it is apparent that they started out as including constants and data that may change. I use them for the same purpose.

Then they have started putting structures into them as well.

One reason as mentioned by Marjan is for framework and platform specific units. One can have the same definitions but different implementations.

Another is to avoid circular unit reference issues. This would probably, also speed up compilation, because smaller units are being loaded in the initial phase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.