[fpc-devel] {$calling register} compiler-directive at wrong place (bug 12881)

Joost van der Sluis joost at cnoc.nl
Sun Jan 11 18:40:24 CET 2009


Hi all,

In the fftw package the {$calling cdecl}  directive is at the top of the
file, and {$calling register} is somewhere in the interface section.

Now the problem seems to be that the function defined directly before
the {$calling register} directive is already defined as register.

This code: (from packages/fftw/fftw_s.pas)

{$calling cdecl}
...
procedure fftw_execute(plan:fftw_plan_single);
          external 'fftw3f' name 'fftwf_execute'; // <-- register
{$calling register}


The procedure fftw_execute is called by the example (fftw/examples) as
being register. If you place another function in between the declaration
and the compiler-directive, it is cdecl:


{$calling cdecl}
...
procedure fftw_execute(plan:fftw_plan_single);
          external 'fftw3f' name 'fftwf_execute'; // <-- cdecl
function
fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pcomplex_single;o:Psingle;
                       flags:fftw_flagset):fftw_plan_single;
         external 'fftw3f' name 'fftwf_plan_dft_c2r';
{$calling register}

How can that happen?

Joost




More information about the fpc-devel mailing list