BUG: MFC Library Build Fails with NOSTRICT Defined

ID: Q117795

1.50 WINDOWS kbprg kbbuglist

The information in this article applies to:

SYMPTOMS

Specifying OPT="/DNOSTRICT" when building the MFC Library version 2.5 variants generates the following message:

   oledobj2.cpp(706) : error C2664: 'CallWindowProc' : cannot convert
     parameter 1 from 'long (__far __pascal *)(unsigned int ,unsigned
     int ,unsigned int ,long )' to 'int (__far __pascal *)(void )'

CAUSE

The problem is caused by the declaration of afxPrevClipboardWndProc (OLEDOBJ2.CPP, line 692). The variable is declared like this:

   extern WNDPROC NEAR _afxPrevClipboardWndProc;

That variable is passed as the first argument to the CallWindowProc in line 706. The CallWindowProc is declared in the WINDOWS.H file like this:

   #ifdef STRICT
   LRESULT WINAPI CallWindowProc(WNDPROC, HWND, UINT, WPARAM, LPARAM);
   #else
   LRESULT WINAPI CallWindowProc(FARPROC, HWND, UINT, WPARAM, LPARAM);
   #endif

In the case that STRICT is not defined, the _afxPrevClipboardWndProc variable does not match the type of the first argument to CallWindowProc, and the error is generated.

RESOLUTION

Modify line 692 in OLEDOBJ2.CPP to provide the correct declaration by using preprocessor directives. For example:

   #ifdef STRICT
   WNDPROC NEAR _afxPrevClipboardWndProc;
   #else
   FARPROC NEAR _afxPrevClipboardWndProc;
   #endif

STATUS

Microsoft has confirmed this to be a bug in the Microsoft Foundation Classes for Windows, version 2.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional reference words: NOSTRICT library build 1.50 2.50 KBCategory: kbprg kbbuglist KBSubcategory: MfcMisc Keywords : kb16bitonly

Last Reviewed: July 23, 1997