Thunking considerations affect the way in which a 16-bit function must be declared within the 32-bit module, and the way in which parameters to be passed to the 16-bit function are defined. Such functions and parameters must be declared using the #pragma linkage directive and the far16 keyword, as shown in Figure "Declaring a 16-Bit Function in 32-Bit Code".
Note the use of the #pragma stack16 directive to set the stack size for all 16-bit function calls made from the 32-bit module.
Declaring a 16-bit function in this manner will cause the operating system to automatically perform thunking for all "value" parameters (that is, those other than pointers). Pointers passed as parameters must be explicitly defined using the _Seg16 keyword, as shown in Figure "Declaring a 16-Bit Function in 32-Bit Code".
The #pragma linkage and #pragma stack16 directives are discussed in more detail in the IBM C Set/2 User's Guide.