Name
Pascal Directive
Syntax
Subroutine declaration; pascal;Description
The pascal directive tells the compiler to use
Pascal calling conventions for the function or procedure. The caller
of the subroutine pushes arguments onto the stack, starting with the
leftmost argument. Before the subroutine returns, the subroutine pops
the arguments from the
stack.
Functions return ordinal values, pointers, and small records or sets
in EAX and floating-point values on the FPU stack.
Strings, dynamic arrays, Variants, and large
records and sets are passed as a hidden var
parameter. If the subroutine is a method, Self is
the first parameter, and the hidden var parameter
is the second, so these parameters are pushed first onto the stack.
Tips and Tricks
Don’t be deceived by the name. Delphi’s default calling
convention is register, not
pascal. The pascal convention
is for backward compatibility, and should not be used except to
interface with an archaic DLL.
See Also
| CDecl Directive, Function Keyword, Procedure Keyword, Register Directive, SafeCall Directive, StdCall Directive |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access