PRB: C2080 Error When Callback Function Declared as _fastcallLast reviewed: July 17, 1997Article ID: Q77141 |
6.00 6.00a 6.00ax 7.00 | 1.00 1.50
MS-DOS | WINDOWSkbtool kbprb The information in this article applies to:
SYMPTOMSAn 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 functionFor Microsoft C versions 6.0, 6.0a, and 6.0ax:
error C2080: illegal far _fastcall function CAUSEAn 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.
RESOLUTIONModify 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.
MORE INFORMATIONIn 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |