Name

$ExternalSym Compiler Directive

Syntax

{$ExternalSym Identifier}

Scope

Local

Description

The $ExternalSym compiler directive tells C++ Builder that Identifier is an external symbol that should not be defined in the C++ header file (.hpp) it generates for the Pascal unit.

Sometimes a symbol you must define in the Pascal unit is already defined elsewhere in C++ Builder. Use the $ExternalSym compiler directive to prevent C++ Builder from writing the symbol in the .hpp file. Note that the compiler uses the unit name as a namespace name. When you use $ExternalSym, you are telling the compiler that the symbol is defined outside the namespace. Contrast this behavior with the $NoDefine directive, where the symbol is defined in the unit’s namespace.

Example

type
  size_t = LongWord;
  {ExternalSym size_t} {C++ already defines this type}
var
  S: size_t;

See Also

$HppEmit Compiler Directive, $NoDefine Compiler Directive, $NoInclude Compiler Directive

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.