FUNCTION-POINTER phrase
The FUNCTION-POINTER phrase defines an item as a function-pointer data item. A function-pointer data item can contain the address of a descriptor for a procedure entry point.
A function-pointer is a 4-byte elementary item or an 8-byte elementary item depending on whether the LP(32) or LP(64) is in effect. If LP(32) is in effect, 4 bytes are allocated for the item; otherwise, 8 bytes are allocated for the item. Function-pointers have the same capabilities as procedure-pointers. Function-pointers are thus more easily interoperable with C function pointers.
A function-pointer can point to a function descriptor for one of the following or can contain NULL:
- The primary entry point of a COBOL program, defined by the PROGRAM-ID paragraph of the outermost program
- An alternate entry point of a COBOL program, defined by a COBOL ENTRY statement
- An entry point in a non-COBOL program
A VALUE clause for a function-pointer data item can contain only NULL or NULLS.
The GLOBAL, EXTERNAL, OCCURS and VOLATILE clauses can be used with USAGE IS FUNCTION-POINTER.
A function-pointer can be used in the same contexts as a procedure-pointer, as defined in PROCEDURE-POINTER phrase.