Compiler directives for libraries or shared objects (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Delphi Compiler Directives (List) Index

Type

Parameter

Syntax

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

Defaults

$LIBPREFIX 'lib' or $SOPREFIX 'bpl'
$LIBSUFFIX ' '
$LIBVERSION ' '

Scope

Global



Remarks

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:

{$LIBPREFIX ''}

$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:

something-mytools.dll

$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:

libsomething.2.1.3.dll

See Also