Compiler directives for libraries or shared objects (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Delphi Compiler Directives (List) Index




$LIBPREFIX 'string'
$LIBSUFFIX 'string'
$LIBVERSION 'string'


$LIBPREFIX 'lib' or $SOPREFIX 'bpl'




The $LIBPREFIX, $LIBSUFFIX, and $LIBVERSION directives allow you to construct a uniquely named image while ensuring that the intermediate symbol file (the .dcp or .bpi) remains 'undecorated'.

Using these directives, you:

  • Need only to reference the <base-name>.dcp (or simply <base-name> from the 'requires' clause of a dpk).
  • Can make changes to the output file versions without having to update all source references.

In the IDE, you can set these directives on the Project > Options > Description page.

$LIBPREFIX overrides the default 'lib' or 'bpl' prefix in the output file name. For example, for a design-time package, you could specify:

{$LIBPREFIX 'dcl'}

Or you could use the following directive to eliminate the prefix entirely:


$LIBSUFFIX adds a specified suffix to the output file name before the $LIBVERSION string, if present, and the extension. For example, use:

{$LIBSUFFIX '-mytools'}

in something.dpr to generate:


$LIBVERSION adds specified version data to the output file name immediately before the file extension, adding a period/full stop separator preceding the specified string. For example, use:

{$LIBVERSION '2.1.3'}

in something.dpr to generate:


See Also