[fpc-pascal] alias a function + overload 'in'
Tomas Hajny
XHajT03 at hajny.biz
Sun Dec 18 22:24:05 CET 2011
On 18 Dec 11, at 10:31, Marcos Douglas wrote:
> On Sun, Dec 18, 2011 at 9:37 AM, Tomas Hajny <XHajT03 at hajny.biz> wrote:
> > On 17 Dec 11, at 21:07, David Emerson wrote:
> >
> >> two little questions
> >>
> >> 1. Is it possible to make an alias to a function ... so rather than just
> >> re-calling with the same parameters, it's actually the same thing? like the way
> >> we can do, e.g., type natural = cardinal, or const GG = 6, but with a function?
> > .
> > .
> >
> > There are multiple solutions possible:
> >
> > 1) Making the functions public and creating the aliases as external:
> >
> > procedure X; public name 'X';
> > begin
> > WriteLn (1);
> > end;
> >
> > procedure Y; external name 'X';
> >
> > begin
> > X;
> > Y;
> > end.
>
> What is this syntax using "public name"?
This syntax allows calling of the published procedure / function from
other object files (typically created in other compilers /
programming languages); "public" says that calling from other objects
files shall be possible and the optional "name" part allows you to
specify a fixed name under which it is be accessible (in addition to
the standard mangled name used by FPC).
Tomas
More information about the fpc-pascal
mailing list