Comparison of User-Defined Function Features: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Gordon.dye (talk | contribs) No edit summary |
||
(4 intermediate revisions by one other user not shown) | |||
Line 4: | Line 4: | ||
{| {|cellspacing="2" cellpadding="5" border="1" | {| {|cellspacing="2" cellpadding="5" border="1" | ||
|- | |- | ||
| Quality | ! rowspan="2"|Quality | ||
| User Defined Function | ! rowspan="2"|Normal User Defined Function | ||
| User Defined Library Function in | ! rowspan="2"|User Defined Library Function in Main Program | ||
| User Defined Library Function | ! colspan="3"|User Defined Library Function in Separate Program | ||
|- | |- | ||
!Resident | |||
!Present | |||
!As Needed | |||
|- | |- | ||
| | |LIBRARY keyword required on DEF statement | ||
|no | |||
|yes | |||
|yes | |||
|yes | |||
|yes | |||
|- | |||
|Linkage must be established (via LIBRARY statement) before function may be called | |||
|no | |||
|yes | |||
|yes | |||
|yes | |||
|yes | |||
|- | |||
|Program may be specified in named LIBRARY statement | |||
|n/a | |||
|no | |||
|yes | |||
|yes | |||
|yes | |||
|- | |||
|Loaded program will be searched for function when unnamed LIBRARY statement is executed | |||
|n/a | |||
|yes | |||
|yes | |||
|yes | |||
|no | |||
|- | |||
|Main program's global variables are available to the function | |||
|no | |||
|yes | |||
|no | |||
|no | |||
|no | |||
|- | |||
|Point at which global variables are cleared | |||
|When main program ends | |||
|When main program ends | |||
|When main program ends (Default). Other options available | |||
|When main program ends | |||
|When function call ends | |||
|- | |||
|Using OPTION RETAIN in the library program causes the library to retain global variables irrespective of when the program ends | |||
|n/a | |||
|na/a | |||
|yes | |||
|no | |||
|no | |||
|- | |||
|Library is loaded into memory with the LOAD command | |||
|n/a | |||
|n/a | |||
|yes | |||
|no | |||
|no | |||
|- | |||
|Library is cleared from memory with the CLEAR command | |||
|n/a | |||
|n/a | |||
|yes | |||
|no | |||
|no | |||
|- | |||
|Library is automatically removed from memory when all function definitions are reassigned | |||
|n/a | |||
|n/a | |||
|no | |||
|yes | |||
|n/a | |||
|- | |||
|Library is automatically removed from memory when main program ends | |||
|n/a | |||
|n/a | |||
|no | |||
|yes | |||
|n/a | |||
|} | |} | ||
Latest revision as of 11:25, 16 October 2014
The following table illustrates the similarities and differences between regular user-defined functions (non-library) and library user-defined functions.
Quality | Normal User Defined Function | User Defined Library Function in Main Program | User Defined Library Function in Separate Program | ||
---|---|---|---|---|---|
Resident | Present | As Needed | |||
LIBRARY keyword required on DEF statement | no | yes | yes | yes | yes |
Linkage must be established (via LIBRARY statement) before function may be called | no | yes | yes | yes | yes |
Program may be specified in named LIBRARY statement | n/a | no | yes | yes | yes |
Loaded program will be searched for function when unnamed LIBRARY statement is executed | n/a | yes | yes | yes | no |
Main program's global variables are available to the function | no | yes | no | no | no |
Point at which global variables are cleared | When main program ends | When main program ends | When main program ends (Default). Other options available | When main program ends | When function call ends |
Using OPTION RETAIN in the library program causes the library to retain global variables irrespective of when the program ends | n/a | na/a | yes | no | no |
Library is loaded into memory with the LOAD command | n/a | n/a | yes | no | no |
Library is cleared from memory with the CLEAR command | n/a | n/a | yes | no | no |
Library is automatically removed from memory when all function definitions are reassigned | n/a | n/a | no | yes | n/a |
Library is automatically removed from memory when main program ends | n/a | n/a | no | yes | n/a |