Declaring external functions

Before you can use an external function in a script, you must declare it.

Two types

You can declare two types of external functions:

Datatypes for external function arguments

When you declare an external function, the datatypes of the arguments must correspond with the datatypes as declared in the function’s source definition.

For a comparison of datatypes in external functions and datatypes in PowerBuilder, see the section on declaring and calling external functions in the PowerScript Reference.

StepsTo declare an external function:

  1. If you are declaring a local external function, open the object for which you want to declare it.

  2. In the Script view, select Declare in the first drop-down list and either Global External Functions or Local External Functions from the second list.

  3. Enter the function declaration in the Script view.

    For the syntax to use, see the PowerScript Reference or the examples below.

  4. Save the object.

    PowerBuilder compiles the declaration. If there are syntax errors, an error window opens, and you must correct the errors before PowerBuilder can save the declaration.

NoteModifying existing functions You can also modify existing external function declarations in the Script view.