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

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

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...