Statement REQUEST Foundation

Defines a list with names for the linker.

Syntax
REQUEST <ModuleName,...>
Parameters
<ModuleName,...>
<ModuleName> is a comma separated list of module names (PRG files) or user-defined functions and procedures which are to be explicitly linked into the EXE file.
Description

The REQUEST statement declares a list of module names that are to be linked into the EXE file. The declaration must come before the first executable statement at the beginning of a source code file or before the first executable statement within a user-defined function.

REQUEST is required when a program module, a function or a procedure is not visible at compile time, but nevertheless must be linked into the EXE file. This situation can occur when the procedure or function name is a character string and is compiled at runtime with the macro operator (&). Since the module name is not explicitly mentioned and cannot be determined at compile time, REQUEST forces the module name into the object file to make it available to the linker.

REQUEST is necessary in the following situations:

User-defined functions used in an index key but not elsewhere in the program

Procedures and UDFs which are called in macro expressions

Procedures which are declared as INIT PROCEDURE or EXIT PROCEDURE (ANNOUNCE must also be used)

User functions for AChoice(), DbEdit() or MemoEdit() defined as character strings or that occur in other PRG files.

When identical REQUEST statements occur in multiple PRG files, they can be placed in an Include file which can then be included as needed with the #include directive.

Examples
REQUEST usage
// The example illustrates the use of ANNOUNCE and REQUEST. 
// Two files are shown: ANNOUNCE is used in DATADICT.PRG and 
// REQUEST is used in TEST.PRG. 

********************* 
** File: TEST.PRG  ** 
********************* 
PROCEDURE Main 

   REQUEST DataDictionary           // Request symbol for linker 

   DeclareDbf() 
   OpenDataBase() 

RETURN 
////// 
// EOF 
////// 

************************* 
** File:  DATADICT.PRG ** 
************************* 
ANNOUNCE DataDictionary             // Declare module name 

STATIC  saDbfFiles := {} 

PROCEDURE OpenDataBase() 
   LOCAL n, nMax 

   nMax := Len( saDbfFiles ) 
   FOR n:=1 TO nMax 
      SELECT (n) 
      USE (saDbfFiles[n,1]) ALIAS (saDbfFiles[n,2]) 
   NEXT 
RETURN 

PROCEDURE DeclareDbf() 
   IF Empty( saDbfFiles ) 
      AAdd( saDbfFiles , { "CUSTOMER.DBF", "CUST" } ) 
      AAdd( saDbfFiles , { "BILLING.DBF" , "BILL" } ) 
      AAdd( saDbfFiles , { "ARTICLE.DBF" , "ART"  } ) 
   ENDIF 
RETURN 
////// 
// EOF 
////// 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.