Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Shared Library and DLL Support : Passing parameters to a shared library routine : Shared library parameter data types : Data type compatibilities
 
Data type compatibilities
For each parameter definition, you must specify a data type that is compatible with the standard C data type of the corresponding DLL routine parameter. Many data types referenced by DLL routines have the same memory size and usage.
The following table lists each supported memory size and usage, examples of corresponding C data types, and the ABL DLL parameter data type you must use for each one.
Table 53. C and DLL parameter data type compatibilities
Example C data type
DLL parameter data type
Data type size and usage
char
BYTE
8-bit unsigned integer
short
SHORT
16-bit signed integer
unsigned short
UNSIGNED-SHORT
16-bit unsigned integer
int1
long (32-bit UNIX, Win32)
LONG
32-bit signed integer
unsigned int2
UNSIGNED-LONG
32-bit unsigned integer
_int64 (Win32)
long long (UNIX 32-bit)
long (UNIX 64-bit)
INT64
64-bit signed integer
float
FLOAT
4-byte floating point
double
DOUBLE
8-byte floating point
char*
CHARACTER
Address (32 bits for 32-bit platforms, 64 bits for 64-bit platforms.)
c-data-type3
HANDLE TO parameter-data-type 4
Address (32 bits for 32-bit platforms, 64 bits for 64-bit platforms.)
char*, output-pointer (which can be char**, short**, and so on), or a pointer to a structure
MEMPTR
Address (32 bits for 32-bit platforms, 64 bits for 64-bit platforms.)

1 The C data type int generally specifies a size that depends on the operating system.

2 The C data type int generally specifies a size that depends on the operating system.

3 You can use the HANDLE TO option to specify a pointer to a scalar type. Therefore, you can use the HANDLE TO option with the parameter data types (that is, BYTE, SHORT, UNSIGNED-SHORT, LONG, FLOAT, and DOUBLE) in order to specify a pointer to the respective C data types (that is, char, short, unsigned short, long, int, float, and double). For CHARACTER and MEMPTR parameters, it is redundant because this data type is always passed using a pointer (char*).

4 You can use the HANDLE TO option to specify a pointer to a scalar type. Therefore, you can use the HANDLE TO option with the parameter data types (that is, BYTE, SHORT, UNSIGNED-SHORT, LONG, FLOAT, and DOUBLE) in order to specify a pointer to the respective C data types (that is, char, short, unsigned short, long, int, float, and double). For CHARACTER and MEMPTR parameters, it is redundant because this data type is always passed using a pointer (char*).

To indicate that the DLL or UNIX shared library parameter is a pointer to a value rather than the value itself, use the HANDLE option. The HANDLE option is required when the DLL routine expects a pointer to the value. Note that the CHARACTER data type implies the HANDLE option, whether or not you specify it. The TO keyword aids readability but has no meaning.