C/C++ Compiler (cl.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Pascal Calling Convention (/Gc)
◄Up► ◄Contents► ◄Index► ◄Back►
─────C/C++ Compiler─────────────────────────────────────────────────────────
If you use the /Gc option, the entire module is compiled using the
Pascal/FORTRAN calling and naming conventions. You might use this
method to make it possible to call all the functions in a C module
from another language or to gain the performance and size
improvement provided by this calling convention.
For the Pascal calling convention, the leftmost argument is pushed
on the stack first, the rightmost last. For the naming convention,
no special characters are prepended to public Pascal-type functions
and all names are translated into uppercase.
When you use /Gc to compile a module, the compiler assumes that all
functions called from that module use the Pascal/FORTRAN calling
convention, even if the functions are defined outside that module.
Therefore, using /Gc would usually mean that you cannot call or
define functions that take variable numbers of parameters and that
you cannot call functions such as the C library functions that use
the C calling sequence. In addition, if you compile with the /Gc
option, either you must declare the main function in the source
program with the __cdecl keyword, or you must change the startup
routine so that it uses the correct naming and calling conventions
when calling main.
NOTES:
■ The varargs and stdargs macros are incompatible with the
Pascal convention.
■ You can cause individual functions to observe the Pascal
conventions by declaring them with the __pascal keyword.
See also: ◄C Calling Convention►
◄Fastcall Calling Convention►
-♦-