ID: Q77141
6.00 6.00a 6.00ax 7.00 | 1.00 1.50
MS-DOS | WINDOWS
kbtool kbprb
The information in this article applies to:
- Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax
- Microsoft C/C++ for MS-DOS, versions 7.0
- Microsoft Visual C++ for Windows, versions 1.0 and 1.5
An attempt to compile an application fails and one of the following messages appears on the screen. For Microsoft C/C++ versions 7.0 and 8.0:
error C2080 : illegal __far __fastcall function or __saveregs
function
For Microsoft C versions 6.0, 6.0a, and 6.0ax:
error C2080: illegal far _fastcall function
An application for the Microsoft Windows operating system declares a FAR function with the __fastcall calling convention and the compiler command line contains the /Gw or /GEf (and /GA or /GD) compiler option switch.
Microsoft Windows callback functions do not support the _fastcall calling convention. Because the /Gw or /GEf (combined with /GA or /GD) compiler option switches generate the Windows prolog and epilog code for all __far functions, the compiler generates the errors listed above for each __fastcall funciton.
Modify the source code to remove the __fastcall declaration from callback functions. An application can use the __fastcall calling convention for its internal functions; in other words, those functions called within the program and not by Windows itself.
In an application designed for the Microsoft Windows operating system, callback functions include window procedures, hook funcitons, enumeration functions, and so forth.
The Windows prolog code modifies the AX register. However, in the __fastcall calling convention, the AX register contains one funciton parameter. The errors are caused by this conflicting register use.
When an application specifies both the __export and __fastcall options, the compiler generates the following message:
error C2216: __fastcall cannot be used with __export
Additional reference words: 1.00 1.50 6.00 6.00a 6.00ax 7.00 8.00 8.00c
KBCategory: kbtool kbprb
KBSubcategory: CLIss
Keywords : kb16bitonly
Last Reviewed: July 18, 1997