### Call Back to 32-bit Code from 16-bit Code

Some 16-bit applications require that calling applications register callback functions. For example, IBM Communications Manager requires callback functions to handle some events. When you call these 16-bit applications from 32-bit code, you can pass a pointer to a 32-bit function that will act as the callback function.

The 32-bit callback function must use the _Far16 _Cdecl or _Far16 _Pascal calling convention. The _Far16 _Fastcall convention is not supported for callback functions. All pointer parameters must be qualified with the _Seg16 type qualifier.

IBM C and C++ Compilers performs all necessary changes from the 16-bit to the 32-bit environment on entry to the callback function, and from 32-bit to 16-bit on exit.

Call between 32-bit and 16-bit Code

#pragma stack16