EXTERNAL FUNCTION‑ENDEXTERNAL

Declare an external function

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
EXTERNAL FUNCTION
    function_1   ,access_type
function_2   ,access_type
[ENDEXTERNAL]

Arguments

function

The name of the external function you want to use.

access_type

The access type of the value returned by the function. Access_type is one of the following data types: a, d, d., i, p, or p., or ^VAL (return integer by value).

Discussion

The EXTERNAL FUNCTION statement declares one or more functions that your program will use and defines their return data types.

All nonprototyped, nonlocal user‑defined functions must be declared with the EXTERNAL FUNCTION statement before you can use them. The EXTERNAL FUNCTION statement is not used with intrinsic functions; however, occasionally it is required for a system‑supplied external function. When this is the case, the documentation will make clear what needs to be declared.

If an external function has the same name as an intrinsic function, the external function declaration replaces the intrinsic function.

Examples

The example below calls the external function sqroot, which returns a decimal value.

record
    val1        ,d4
    val2        ,d4
    result      ,d6.4
external function
    sqroot      ,d

proc
    .
    .
    .
    result = %sqroot(val1, val2)