Data Types Supported By the Thunk Compiler
The thunk compiler supports some C data types as parameters, return values, or both. The following data types are supported as function parameters:
-
Scalar data types such as int, char, unsigned int, and unsigned long.
-
A special type, bool, that is not supported by the C/C++ compiler. You should use bool in your thunk script for functions that use a nonzero value other than 1 to represent TRUE.
-
Pointers to scalar data types.
-
Structures passed by value or reference.
-
Structures within structures.
-
Pointers within structures, provided that the data type pointed to does not require repacking. The object can be another structure.
-
Arrays of scalar values embedded in structures.
The following data types are supported as function return values:
-
Scalar data types such as int, char, unsigned int, and unsigned long.
-
A special type, bool, that is not supported by the C/C++ compiler. You should use bool in your thunk script for functions that use a nonzero value other than 1 to represent TRUE.
-
Pointers to scalar data types for 32-bit to 16-bit thunks, provided that the data type does not change size. For example, pointers to int are not supported, because an int is 16 bits long in 16-bit code and 32 bits long in 32-bit code.
-
Structure pointers for 32-bit to 16-bit thunks, provided that the structure requires no repacking and contains no pointers. The segment address on the 16-bit side is not globally fixed by the thunk compiler. As a general rule, the thunk compiler deallocates the selectors it allocates.
-
Arrays of scalar values embedded in structures.
Note The int data type is 16 bits wide in 16-bit code and 32 bits wide in 32-bit code. In 32-bit to 16-bit thunks, variables of type int are first truncated from 32 bits to 16 bits (less than 65536), then sign-extended to 32 bits upon return. Likewise, in 16-bit to 32-bit thunks, variables of type int are first sign-extended to 32 bits, then truncated to 16 bits on return.