xHarbour Reference Documentation > Statement Reference xHarbour Developers Network  

EXTERNAL

Declares the symbolic name of an external function or procedure for the linker.

Syntax

EXTERNAL <name1> [,<nameN>]

Arguments

EXTERNAL <name>
This is the symbolic name of a function or procedure to declare for the linker. When multiple names are declared, they must be separated with commas.

Description

The EXTERNAL statement declares a symbolic name of a function or procedure for the linker. This is usually required when there is no direct call of a function or procedure in PRG code, for example when a function is only called within a macro-expression using the macro-operator. By declaring the symbolic name of a function as EXTERNAL, the linker is forced to link the corresponding function to the executable file.

Note:  It is common practice to use the EXTERNAL declaration within an #include file. This way it is assured that functions are available in all PRG files that may call them indirectly.

Info

See also:#include, ANNOUNCE, REQUEST
Category: Declaration , Statements

Example

// The example forces the linker to link three functions that are only
// called within a macro expression.

   EXTERNAL Memoedit, Memoread, Memowrit
   MEMVAR   fileName
   STATIC   cEditor := "Memowrit(fileName,Memoedit(Memoread(fileName)))"

   PROCEDURE Main( cFile )
      fileName := cFile
      &cEditor
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe