comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Addressing functions
Date: 16 Dec 1994 09:53:28 -0500
Date: 1994-12-16T09:53:28-05:00	[thread overview]
Message-ID: <3cs9l8$mos@gnat.cs.nyu.edu> (raw)
In-Reply-To: 3clisk$9th@felix.seas.gwu.edu

Michael (Feldman), I think you missed the point of the question about
address applied to subprograms. What the original poster wants is a way
of using (i.e. CALLING) these subprograms given the address.

This is of course the feature that has been added to Ada 9X. There is no
guaranteed way of doing it in Ada 83, it is completely outside the
standard. Nevertheless, it is often possible to set up kludges for
a particular compiler.

If your compiler gives the entry point of the function as the 'Address,
then at least for global level functions, you can probably use some
assembly glue to call them. This won't work for nested functions, because
you won't be able to materialize the static link or display.

On some compilers it will work to do something like:

      procedure p is ...  

      x : address;

      x := p'address;  -- or whatever ..

now to call the procedure:

      declare
         procedure dummy;
         for dummy'address use x;
         pragma interface (Ada, dummy);
      begin
	 dummy;
      end;

this is not guaranteed to work, but it may work on some compilers.

Best answer to original question: use Ada 95!




  reply	other threads:[~1994-12-16 14:53 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
1994-12-14  1:48 ` Michael Feldman
1994-12-16 14:53   ` Robert Dewar [this message]
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