[fpc-devel] procedure declaration forward, to other unit ?

Martin lazarus at mfriebe.de
Sun Feb 26 18:45:03 CET 2012

If I have a class TFoo in UnitFoo, then I can :

   unit UnitOther;
   uses UnitFoo;
   type TFoo = UnitFoo.TFoo;

Now people who use UnitOther, can use TFoo, but do nut need to 
explicitly use UnitFoo.

I am looking for a way to do that with procedures.

Of course I can declare them and add a forward call. And *IF" the 
compiler can inline then there is not even extra code in the app... 
"IF". But it can not always (e.g "array of const" seems to never inline)

So what options are there?
Handing it to the linker, by declaring an alias name, and using 
external? But that cuts the checks that both declarations are equal....

untyped const do not work either
   procedure Foo(a: Integer);
   const  Bar = @Foo;

this would work
   procedure Foo(a: Integer);
   const    Bar: procedure(a: integer) = @Foo;

Bar would be dereferenced as long as () are given, but it does extra code...

More information about the fpc-devel mailing list