From: bobduff@dsd.camb.inmet.com (Bob Duff)
Subject: Re: Addressing functions
Date: Tue, 13 Dec 1994 19:04:15 GMT
Date: 1994-12-13T19:04:15+00:00 [thread overview]
Message-ID: <D0rJn3.JH4@inmet.camb.inmet.com> (raw)
In-Reply-To: 3citrc$bb5@earth.usa.net
In article <3citrc$bb5@earth.usa.net>, Bill Buckley <wbuckley@earth> wrote:
>
> ...I know I can get the address of a subprogram via the ADDRESS
>attribute in Ada but can not figure a way to use it.
In Ada83, there is no portable way to call such a subprogram. If you
know the machine-level calling conventions used by your compiler, you
can write a machine code insertion that does, but that's pretty nasty.
In Ada 9X, you can use access-to-subprogram types:
type String_Procedure is access procedure (S: String);
X: String_Procedure := Text_IO.Put'Access;
Now you can call X like this:
X("Hello, world");
which means the same as this:
X.all("Hello, world");
--
Bob Duff bobduff@inmet.com
Oak Tree Software, Inc.
Ada 9X Mapping/Revision Team (Intermetrics, Inc.)
next prev parent reply other threads:[~1994-12-13 19:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-12-13 1:36 Addressing functions Bill Buckley
1994-12-13 10:14 ` Robert I. Eachus
1994-12-14 13:59 ` Theodore E. Dennison
1994-12-16 14:18 ` Arthur Evans Jr
1994-12-17 17:27 ` Robert Dewar
1994-12-17 17:32 ` Robert Dewar
1994-12-18 6:44 ` Bill Buckley
1994-12-16 16:56 ` Robert Dewar
1994-12-13 19:04 ` Bob Duff [this message]
1994-12-14 1:48 ` Michael Feldman
1994-12-16 14:53 ` Robert Dewar
1994-12-17 7:23 ` Addressing functions (long) Michael M. Bishop
1994-12-18 6:53 ` Bill Buckley
1994-12-14 12:33 ` Addressing functions Mitch Gart
1994-12-15 16:26 ` Erich A. Pfeiffer
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox