I have the following:

unit foo;

{$mode objfpc}{$H+}

interface
uses
  foobar;

function BitCnt(ABitmap: TBitBoard): Integer;

implementation

{$ifdef cpu386}
function BitCnt(ABitmap: TBitBoard): Integer; assembler; register; nostackframe;
asm
  ...
end;
{$else}
function BitCnt(ABitmap: TBitBoard): Integer; inline;
begin
  ...
end;

This seems to compile and work as intended, no matter which of the two
implementations I choose. But I wonder how this can work? I always
thought that what is written in the interface section is
authoritative. How can the compiler properly use this unit and call
the function when the implementation actually implements a completely
different calling convention (inline) than the one that is declared in
the interface section?

Bernd
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to