ID Number: Q77141
6.00 6.00a 6.00ax
MS-DOS
Summary:
When declaring a FAR function with the _fastcall calling convention in
a Windows program, and compiling with the /Gw switch, the following
error will be generated by Microsoft C versions 6.0, 6.0a, and 6.0ax:
error C2080: illegal far _fastcall function
A far _fastcall function may not be compiled with the /Gw option,
or with the /Gq option if stack checking is enabled.
More Information:
The _fastcall calling convention is not supported with Windows
callback functions. In other words, window procedures, hook functions,
enumeration functions, and so on, do not support the use of _fastcall.
As for generic FAR functions, _fastcall is not supported with any
functions compiled with the /Gw switch.
The windows prologue uses AX, which is one of the registers used to
hold the _fastcall parameters. Because Windows (in certain
configurations) patches the prologue code by recognizing the use of AX
to load DS at the beginning of the prologue, AX must be used. This
conflicts with the use of AX as a _fastcall argument, and one of the
values will be lost.
In most situations when programming under Windows, the performance
benefits to using _fastcall are minimal. The best situation would be a
near function that is called repeatedly in a loop. Therefore, using
_fastcall does not yield any significant performance boost within
Windows.
Additional reference words: 6.00 6.00a 6.00ax