Delphi Error – E2278 Cannot take address of local symbol %s

Delphi Compiler Error

E2278 Cannot take address of local symbol %s

Reason for the Error & Solution

This message occurs when you try to call a symbol from within a procedure or function that has been tagged with the local directive.

The local directive, which marks routines as unavailable for export, is platform-specific and has no effect in Windows programming.

On Linux, the local directive is used for routines that are compiled into a library but are not exported. This directive can be specified for standalone procedures and functions, but not for methods. A routine declared with local, for example,

function Contraband(I: Integer): Integer; local;

does not refresh the EBX register and hence

  • cannot be exported from a library.
  • cannot be declared in the interface section of a unit.
  • cannot have its address taken or be assigned to a procedural-type variable.
  • if it is a pure assembler routine, cannot be called from another unit unless the caller sets up EBX.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...