Platform SDK: Win32 API

Thunk Compiler

This overview describes how to use the thunk compiler so that your Win32-based application running on Microsoft® Windows® 95/98 can take advantage of 16-bit components. In addition, this overview discusses related issues you should consider before choosing to use the thunk compiler.

Windows 95/98 implements a thunking model called flat thunks. Flat thunks allow 32-bit code to call functions implemented in 16-bit code. They also allow 16-bit code to call functions implemented in 32-bit code. Windows NT/Windows 2000 does not support flat thunks. Therefore, if you use flat thunks, your application cannot run on Windows NT/Windows 2000 unless you isolate your thunking code into platform-specific DLLs.

Windows NT/Windows 2000 implements a thunking model called generic thunks, which allow 16-bit code to call functions implemented in 32-bit code. Although Windows 95/98 supports generic thunks, it does not support the underlying process model used by Windows NT/Windows 2000. This means that generic thunking code might not work identically under Windows 95/98 and Windows NT/Windows 2000. For more information, see Generic Thunks.

The Platform Software Development Kit (SDK) includes a sample application that illustrates the use of the thunk compiler. This application, APP32.EXE, simply passes basic types from the 32-bit side to the 16-bit side of the thunk. This sample is an important supplement to the information in this overview.