Subroutines pass arguments by reference. A subroutine does not return a value, but can modify arguments via its pointers. The prototype for declaring an external subroutine is as follows:
subroutine EslExtSub(TYPE : PARAM1, TYPE : PARAM2)
library "DLLNAME"
where TYPE is one of the ESL data types INTEGER, FLOAT, STRING, or STRUCTURE.
Each argument passed by the subroutine is a pointer that corresponds to the variable type used as a parameter in the subroutine call. The following table shows the correspondence between the ESL variable types and the C data types passed to the subroutine:
ESL Type |
C Type |
integer |
long * |
float |
double * |
string |
HSTRING * (PHSTRING) |
For integer and float arguments, the subroutine can return a value by assigning a value indirectly through the pointer argument.
Caution: Assignment to string variables must be performed through the string-handling API discussed in ESL String Data Type; direct assignment will cause errors.