13.1 The resource directive $R

Under Windows and linux (or any platform using ELF binaries) 1, you can include resources in your executable or library using the {$R filename} directive. These resources can then be accessed through the standard Windows API calls: these calls have been made available in the other platforms as well.

When the compiler encounters a resource directive, it just creates an entry in the unit .ppu file; it doesn’t link the resource. Only when it creates a library or executable, it looks for all the resource files for which it encountered a directive, and tries to link them in.

The default extension for resource files is .res. When the filename has as the first character an asterisk (*), the compiler will replace the asterisk with the name of the current unit, library or program.

RemarkThis means that the asterisk may only be used after a unit, library or program clause.

1As of development version 2.3.1, all FPC supported platforms now have resources available.