One approach for implementing generic thunks is to isolate thunking code into DLLs. The advantage is that you can easily discard the thunking code when it is no longer needed. You can also create separate DLLs for each platform, to isolate platform-specific differences. Another approach for isolating platform differences is to detect the platform at run time and call the appropriate functions for each platform.
The examples in this overview demonstrate the required steps for a 16-bit Windows-based application named APP16
call the MyPrint
routine from the Win32-based DLL named DLL32
. These examples also give hints for isolating thunking code into a DLL named DLL16
.
You can also use generic thunks to call back into the 16-bit side of the thunk from the 32-bit side of the thunk (generic callback). For more information, see WOWCallback16.
Note You can also use generic thunks to translate pointers outside of thunks. For more information, see, Translating 16:16 Pointers.