[fpc-pascal] Question about functions returning a string

Ewald ewald at yellowcouch.org
Sat Nov 29 13:56:41 CET 2014

On 11/29/2014 12:41 AM, Flávio Etrusco wrote:
> Are you sure it's not the result that is passed in the first parameter?
> http://en.wikipedia.org/wiki/X86_calling_conventions#cdecl

Good question, but I don't think so. The first few lines of assembly
from this function seem to read three arguments you see:

  44b360:    53                       push   %rbx
  44b361:    41 54                    push   %r12
  44b363:    41 55                    push   %r13
  44b365:    48 89 fb                 mov    %rdi,%rbx        <-- first
argument, %rdi
  44b368:    41 89 f4                 mov    %esi,%r12d       <-- second
argument, %rsi
  44b36b:    49 89 d5                 mov    %rdx,%r13        <-- third
argument, %rdx

What I forgot to mention was that this is on a x86_64 architecture, so I
based myself on the table found at
http://wiki.osdev.org/Calling_Conventions .


More information about the fpc-pascal mailing list