[fpc-pascal] declaration of functions

Michael Van Canneyt michael at freepascal.org
Fri Oct 15 11:10:08 CEST 2010



On Thu, 14 Oct 2010, Uffe Kousgaard wrote:

> While trying to make delphi code compatible with FPC, I have hit this issue:
>
> Delphi allows:
>
> interface
> function somefunction(a: integer): integer;
>
> implementation
> function somefunction;
> begin
> result:= a*2;
> end;
>
> FPC requires the full declaration to be repeated. Can this be avoided 
> somehow? I have many functions/procedures without full declaration in the 
> implementation part.

Switch on delphi mode:
{$mode delphi}

And then it should work.

FPC is more fussy about it, because unlike delphi, it doesn't require you to
specify 'overload' for overloaded functions. The downside of this is that
you must repeat the full declaration in the implementation section.
(for obvious reasons)

Michael.



More information about the fpc-pascal mailing list