Advanced Procedures


Advanced procedures have to be introduced before explaining the concepts of high-level language interface such as linking assembly language modules to C/C++ programs. Two kinds of variables used in procedures are static global variables and local variables.

Static Global Variables
Variables declared in the data segment are called static global variables. The term static indicates that a variable's lifetime is the same as the duration of the current program. The term global indicates a variable's visibility. A global variable is visible from all procedures in the current source code file.

Local Variables
It is a variable that is created, used, and destroyed within a single procedure. Local variables have distinct advantages over global variables: The LOCAL directive declares one or more local variables inside a procedure. It is placed on the line immediately following a PROC directive. The syntax is
     LOCAL  varlist
varlist is a list of variable definitions, separated by commas, optionally spanning multiple lines. Each variable definition takes the following form:
     label: type
The label may be any valid identifier, and type can either be a standard type or a user-defined type.