Product Information > JADE Development Environment User’s Guide > Chapter 8 - Adding External Methods and External Functions to Classes > Example of Definition of an External Function

Example of Definition of an External Function

The following example shows the definition of an external function.

copyFile(input:  String;
         output: String;
         exists: Boolean): Boolean is CopyFileA in kernel32;

In this example, the value parameter is usage output (that is, the called function is known to update this string parameter).

The specification of a value for the length parameter is mandatory, to allow a string of the correct size to be allocated.

The Unicode version of this WIN32 API has been used in this example, which assumes that callers pass Unicode strings (the default for a Unicode JADE build).

Use the presentationClientExecution or applicationServerExecution option in the function definition of an external function (that is, not in the call expression) to specify where the function call is made, as shown in the following example.

getProfileString(sectionName : String;
                 keyName     : String;
                 default     : String;
                 value       : String[100] output;
                 length      : Integer): Integer is GetProfileStringW in
                                      kernel32 applicationServerExecution;

External functions are called on the JADE thin client workstation by default; that is, presentationClientExecution is assumed.

The presentationClientExecution qualifier has no effect if JADE is not currently running in JADE thin client mode.