Anto Raja Prakash
Anto Raja Prakash

Reputation: 1388

Difference in interface and implementation section having {$R *.DFM} directive

Difference between having {$R *.DFM} directive in interface and implementation section?

what if i have {$R *.DFM} in interface?

interface
{$R *.DFM}

what if i have {$R *.DFM} in implementation?

implementation
{$R *.DFM}

Upvotes: 5

Views: 1240

Answers (1)

Rob Kennedy
Rob Kennedy

Reputation: 163317

It shouldn't make any difference. That instruction ensure that the DFM resource associated with that unit's form gets linked to your executable. All units have access to all resources in the program, so the location of the linking instruction has no effect on the visibility of the resource.

That instruction is placed by the IDE. The IDE can act strangely if you move parts of your code that it's responsible for, so I don't recommend moving the $R command, even if the compiler accepts it anywhere. Leave it wherever you found it.

Upvotes: 3

Related Questions