Declaration Changes

One of the first things you will need to change is the declaration of your functions and subroutines. Win32 uses the stdcall calling convention instead of the pascal calling convention. This means that the pascal keyword should be removed from the declaration. Far has no meaning in a 32-bit context and should be removed from the declaration also. The _export keyword has been replaced with _declspec(dllexport). See the next section for issues on using _declspec(dllexport). An example of how conditional compilation can be used to solve this problem follows. Function names are case-sensitive in Win32.

#if defined(WIN32)
_declspec(dllexport) __stdcall int WINAPI SuperZoom(int Zoom, LPSTR UserHelpFile, LONG wCommand, LONG topic)
#else
int far pascal _export SuperZoom(int Zoom, LPSTR UserHelpFile, LONG wCommand, LONG topic)
#endif

An alternative method that you will see used throughout the samples is to use the WINAPI macro. The WINAPI macro is defined as __stdcall under Win32 and far pascal under Win16.