Name
Register Directive
Syntax
Subroutine declaration; register;Description
The register directive tells the compiler to use
Borland’s fast register calling convention for the function or
procedure. The caller stores the first three arguments in the
registers EAX, EDX, and
ECX, and pushes the remaining arguments onto the
stack, starting with the leftmost argument. Parameters that do not
fit into a 32-bit register (such as Double) are
pushed onto the stack, so the registers contain the first three
arguments that are not on the stack. Before the subroutine returns,
it 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. This hidden parameter is the last parameter. If the
subroutine is a method, Self is passed in
EAX.
Tips and Tricks
Borland’s register calling convention is different from Microsoft’s register calling convention. For maximum compatibility in a DLL or COM object, use
stdcallorsafecallconventions.The
registercalling convention is the default.
See Also
| CDecl Directive, Function Keyword, Pascal Directive, Procedure Keyword, 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