I\'m trying to fix another VCL bug; this time in Vcl.Printers.pas
.
For now we are doing this by copying the buggy VCL source files to another folder in
The error message is a little misleading. I'll try to translate for you. When the compiler says:
Unsupported language feature: 'custom attribute'
what it really means is:
Cannot find a class, derived from
TCustomAttribute
, that matches the attribute name that you specified.
These PrintingPermission
attributes, which are defined by the .net framework, have meaning for the Delphi .net compiler. Which is still used by Embarcadero to build portions of the IDE. Hence the retention of the conditional code which switches on the presence of the CLR
define. When this VCL unit is compiled by the Delphi .net compiler, the compiler can see the .net framework class System.Drawing.Printing.PrintingPermissionAttribute.
There's little to be gained by you trying to deal with warnings in VCL units. It's not your code, and your goal when modifying a VCL unit is to get in and out as quickly as possible. You should be aiming to make the smallest change possible.
So, ignore the warnings. Suppress warnings and hints for the VCL units that you modify. Stuff {$W-}
at the top of any VCL units you compile, and move on. Or if you just cannot bring yourself to be quite so draconian, you could use {$WARN UNSUPPORTED_CONSTRUCT OFF}
.
Taking your questions in turn:
What is the way to make the language support the feature custom attributes?
It's not a language limitation. It's just that these attributes are only defined when targeting .net.
Why is it not a warning in the VCL source?
It is, at least when compiling for a target other than .net.
Why is VCL source allowed to use it when i'm not?
You would be allowed to use them too if you use the .net compiler.
What are these attributes doing?
System.Drawing.Printing.PrintingPermissionAttribute
Who reads these attribues?
The .net framework. I guess.
Are there issues with removing them?
It won't affect the output produced by the Windows compilers. It will increase the volume of differences in your revision control system.
If there are no issues with removing them, why are they there?
Because they are used on .net.