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

Example of Usage of an External Function

The following example shows the usage of an external function.

getIniParameter(key: String; default: String): String;
vars
    value : String[100];
    size  : Integer;
begin
    size := call getProfileString("JadeClient", key, default,
                                  value, value.maxLength);
    return value;
end;

In this example, a fixed-length string is passed to the value parameter. The length of the value parameter string is passed in the length parameter. (This could also have been hard-coded to the length of the value parameter defined in the function signature.)

An exception is raised at run time if the number or types of parameters in your external function definition does not match the parameters expected by the function in the external library. This may be exception 4038 (External function caused an exception) if the error was detected at the time the function call was made.

Exception 4024 (Out of resources for operation) may be raised at some time after the external function was called if, for example, an incorrect parameter definition caused the external function to corrupt memory.