External routines

Dynamic Link Libraries (DLLs) are files that export code and data for applications to load and call at runtime. External DLL routines is the name of the code exported by DLLs.

External routines are Scripting Language constructs that allow scripts to access external DLL routines developed in C or C++.

External routines are declared as external functions or external subroutines as follows:

  • External functions are routines that return values to scripts.
  • External subroutines are routines that do not return values to scripts.

Type mappings are a component of the external routine declarations. The Scripting Language maps simple types and bytestreams to C++ types. Type mappings declare how the Scripting Language converts values to C++.

External routine declarations contain type mappings for the following elements:

  • Formal parameters of external subroutines and functions.
  • Return values of external functions.

C++ developers can create new DLLs in C++ to be used by the Scripting Language. Scripting Language developers can integrate legacy and system DLLs into scripts.

The syntax to call external routines is the same syntax used to call internal routines.

How external routines work

The Agent Portal and Automated Agents load external DLLs together with the scripts that refer to the DLLs.

To call external routines, the Scripting Language coerces and converts values as follows:

  1. Coerces each actual parameter of the call to the type of the corresponding formal parameter declaration.
  2. Converts each of the coerced parameter values to the internal C++ representation of the formal C++ parameter type.
  3. Calls the external DLL routine.
  4. If the called external DLL routine is a function, coerces the return value to the return type of the external function.
  5. Coerces the values of parameters passed by reference to the corresponding formal parameter type.