Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-02

procedure declaration forward, to other unit ?

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

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

   unit UnitOther;
   uses UnitFoo;
   interface
   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...

Reply by email