GLOBAL

Top  Previous  Next

Syntax

GLOBAL function_name

GLOBAL variable_name

Description

Declares a subroutine or variable as being globally visible.

Parameters

function_name - The name of the subroutine to make global.

variable_name - The name of a variable to make global.

Return value

None

Remarks

Subroutines and variables are normally private to the source file they are defined/declare in. Declaring variables as GLOBAL allows other source file modules to use them when using the EXTERN keyword. Declaring subroutines as GLOBAL allows other source file modules to use them when using a DECLARE EXTERN statement. EXTERN and GLOBAL are the heart of multi-module programming.

See Also EXTERN , DECLARE

Example usage

'in the defining source file
GLOBAL myvariable
GLOBAL myfunction
DEF myvariable as UINT
 
SUB myfunction(a as INT),UINT
    RETURN a+5
ENDSUB
-----
'in another source file
EXTERN myvariable as UINT
DECLARE EXTERN myfunction(a as INT),UINT
myvariable = myfunction(7)