Declaring the DLL Function

You can declare the functions to be called through generic thunks (target functions) with either the standard-call calling convention (Intel only) or the C calling convention. It is important to call the target function using the correct convention.

The following example shows how to define the target function, MyPrint, in DLL32 as a standard-call function, using the WINAPI modifier:

void WINAPI MyPrint( LPTSTR lpString, HANDLE hWnd )
{
    ...
}
 

If you are isolating your thunking code into a DLL, create a DLL16 file and define MyPrint in DLL16 as well. Then when you call MyPrint from APP16, you will be calling the version in DLL16 and the version in DLL16 will perform the thunk to DLL32.