Win64/AMD64 API
From Free Pascal wiki
Jump to navigationJump to searchAs far as I know, there is no offical document yet decribing the win64/amd64 api so the follow information is collected from several sources.
Parameter passing
The parameters are passed in a different manner to subroutines than known from amd64/linux.
Integer parameters
The first four parameters are passed in rcx, rdx, r8 and r9. Further parameters are passed on the stack, they are always aligned to 8 byte boundaries regardless of their size. The caller always reserves space on the stack for the parameters passed in registers.