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 stdcall or safecall conventions.

  • The register calling convention is the default.

See Also

CDecl Directive, Function Keyword, Pascal Directive, Procedure Keyword, SafeCall Directive, StdCall Directive
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset