External Parameter Type Correspondence [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
External Parameter Type Correspondence
When a program calls an external routine, the types of the actual
parameters must correspond to the types of the formal parameters.
When a program declares an external function that is not declared as
INTRINSIC, the return type in the EXTERNAL statement must correspond to
the return type in the function's original definition.
Table 3-33 shows the correspondence between parameter types in HP
Business BASIC/XL, HP Pascal/XL, and HP C/XL.
Table 3-33. Parameter Type Correspondence
-----------------------------------------------------------------------------------------------------
| | | | | |
| HP Business | Formal | Formal | Formal | Formal |
| BASIC/XL | Parameter | Parameter | Parameter | Parameter |
| Actual | Typed Declared | Type in | Type in | Type in |
| Parameter | in EXTERNAL | HP Business | HP Pascal/XL | HP C/XL |
| Type | Declaration | BASIC/XL | | |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| String$ | String$ | String$ | STRING | Not supported |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| String$ | BYTE STRING$ | Not supported | Packed array of | char |
| | | | char | |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| Any type except | BYTE | Not supported | Any type | char |
| String$ | | | requiring exactly | |
| | | | 8 bits of storage | |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| SHORT INTEGER | SHORT INTEGER | SHORT INTEGER | SHORTINT | short |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| INTEGER | INTEGER | INTEGER | INTEGER | int |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| SHORTREAL | SHORTREAL | SHORTREAL | REAL | float |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| REAL | REAL | REAL | LONGREAL | double |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| SHORT DECIMAL | SHORT DECIMAL | SHORT DECIMAL | Not supported* | Not supported* |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| DECIMAL | DECIMAL | DECIMAL | Not supported* | Not supported* |
| | | | | |
-----------------------------------------------------------------------------------------------------
Table 3-33 Note
* Decimal parameters can be passed to an external routine written in
any language by defining an appropriate type in that language.
Parameter type correspondence for numeric arrays is the same as that for
scalar numeric parameters. The corresponding formal parameter for string
array parameters in the procedure or function header for the procedure or
function must be a string array that conforms to the type expected by An
HP Business BASIC/XL procedure or function.
All arrays are passed by reference.
Examples
If the external HP Pascal/XL function func is defined:
function func (c: color;
var s: str5;
var i1: int1;
var i2: integer;
r: real;
var l: longreal): real;
And the types color, str5, and int1 are defined:
color = (red,blue,yellow);
str5 = packed array [1..5] of char;
int1 = shortint;
int2 = integer;
Then the following EXTERNAL statement is correct:
100 EXTERNAL PASCAL SHORT REAL FNFunc ALIAS "func" &
(BYTE VALUE C, BYTE S$, SHORT INTEGER I1, INTEGER I2, &
SHORT REAL VALUE R, REAL L)
MPE/iX 5.0 Documentation