Compiler Warning (level 2) C4096

'attribute1' must be used with 'attribute2'

Attribute2 requires the use of attribute1.

For example, using a variable number of arguments (...) requires that __cdecl be used. Also, __interrupt functions must be __far and __cdecl.

The compiler assumed the attribute1 attribute for the function.

Here is an example of the type of code that can cause this problem.

When compiling the project files that contain the following preprocessor directive:

#include <oledlg.h>

with the /Gr switch, the compiler generates the following warning statement:

d:\msdev4\include\oledlg.h(1689): warning C4096 ‘__cdecl’ must be used with ‘...’

The /Gr switch sets __fastcall to be the default calling convention.  Because CDECL in the prototype is defined to nothing, the warning points to the location of the prototype:

int EXPORT FAR CDECL OleUIPromptUserA(int nTemplate, HWND hwndParent, ...)

The above example can be fixed by adding the following preprocessor directive to the project:

#define DOSWIN32

which defines CDECL properly.