Before you can use an external function in a script, you must declare it.
You can declare two types of external functions:
Global external functions, which are available anywhere in the application
Local external functions, which are defined for a particular type of window, menu, or user object
These functions are part of the object’s definition and can always be used in scripts for the object itself. You can also choose to make these functions accessible to other scripts as well.
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.
To declare an external function:
If you are declaring a local external function, open the object for which you want to declare it.
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.
Enter the function declaration in the Script view.
For the syntax to use, see the PowerScript Reference or the examples below.
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.