Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of {$C PRELOAD} directive?

I found this directive declared in Controls.pas (and also in other units) and I'll be glad to know what does it mean.

{$C PRELOAD}

As far as I know $C means assertions control but what is the PRELOAD keyword ? Is it something like "assert me at preloading time" ?

I found this in Delphi 2009

Thank you

like image 993
Martin Reiner Avatar asked Dec 14 '11 01:12

Martin Reiner


2 Answers

The $C directive is called Code segment attribute and in conjuntion with the keywords MOVEABLE, FIXED, DEMANDLOAD, PRELOAD, DISCARDABLE, PERMANENT changues the attributes of a code segment.

{$C MOVEABLE DEMANDLOAD DISCARDABLE} // this is setting  Code Segment Attribute.

if you use the $C directive with a + or - you are using enabling or disabling the generation of code for assertions.

example :

{$C+}    { Assertions - On }
like image 122
RRUZ Avatar answered Oct 28 '22 12:10

RRUZ


{$C+} and {$C-} are for assertions. {$C PRELOAD} is a carryover from 16-bit programming, where it preloaded the unit's code segment into memory immediately at runtime instead of waiting for the segment to be accessed first. That became unnecessary in Delphi 2 when 32-bit programming came around, so I don't know why the VCL source is still using it.

like image 35
Remy Lebeau Avatar answered Oct 28 '22 13:10

Remy Lebeau