comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: Function Calls by Address
Date: 1999/08/31
Date: 1999-08-31T00:00:00+00:00	[thread overview]
Message-ID: <37cbe514@news1.us.ibm.net> (raw)
In-Reply-To: 37CADE68.6AF06F5D@escmail.orl.lmco.com

In article <37CADE68.6AF06F5D@escmail.orl.lmco.com> , Craig Jameson 
<craigj@escmail.orl.lmco.com>  wrote:

> Does any one know how to make dynamic function calls in Ada83.
> I am writing an application using AIX Motif bindings and I
> need to create a dynamic list of functions to be called when
> a particular X event is dispatched.  Any ideas on how to
> create and use such a list?

We always used to use 'Address.  For example:

package P is

  procedure CB
    (W           : Widget;
     Client_Data : Addr_T;
     Call_Data   : Addr_T);

  pragma Interface (C, CB);
  pragma Interface_Name (CB, "pcb");

  pragma Export (CB, Name => "pcb");

(Or something like that.  You might not even need the pragma Export, because
you're referring to the subprogram by its address, not its name.  But I
don't remember.  Look in the vendor's compiler manuals about being able to
call Ada subprograms from another language.)

You can then say CB'Address, which you pass to the C side.

Make the subprogram is at library-level (though the compiler will probably
tell if it isn't).

Yes, this is vendor-specific, but I did X/Motif stuff in Ada83 for many
years (on VMS and SUN boxes), and never had a problem.

As others have pointed out, support for callbacks was added to the language
for Ada95.  The current debate is over support for some form of downward
closures.










  parent reply	other threads:[~1999-08-31  0:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-30  0:00 Function Calls by Address Craig Jameson
1999-08-30  0:00 ` Marin David Condic
1999-08-30  0:00   ` Marin David Condic
1999-08-30  0:00     ` Larry Kilgallen
1999-08-30  0:00   ` Robert Dewar
1999-08-30  0:00 ` Robert Dewar
1999-08-31  0:00   ` Martin Gangkofer
1999-08-30  0:00 ` Robert Dewar
1999-08-31  0:00 ` Matthew Heaney [this message]
1999-08-31  0:00 ` David Kristola
1999-09-01  0:00 ` Simon Wright
1999-09-02  0:00 ` Francois Godme
1999-09-03  0:00   ` Robert Dewar
1999-09-03  0:00     ` Francois Godme
1999-09-03  0:00       ` Simon Wright
1999-09-03  0:00       ` Robert Dewar
1999-09-03  0:00         ` Ted Dennison
1999-09-04  0:00           ` Jean-Pierre Rosen
1999-09-05  0:00             ` Matthew Heaney
1999-09-05  0:00             ` Ehud Lamm
1999-09-04  0:00         ` Brian Rogoff
1999-09-05  0:00           ` Robert Dewar
1999-09-05  0:00           ` Robert Dewar
1999-09-05  0:00           ` Robert Dewar
1999-09-03  0:00       ` Marin David Condic
1999-09-14  0:00         ` Robert I. Eachus
     [not found]           ` <wcc3dwgb7ii.fsf@world.std.com>
     [not found]             ` <37E81079.CC2566D9@mitre.org>
1999-09-22  0:00               ` Robert A Duff
1999-09-22  0:00                 ` Robert I. Eachus
1999-09-23  0:00                 ` Robert Dewar
1999-09-23  0:00                   ` Robert A Duff
1999-09-03  0:00       ` David C. Hoos, Sr.
1999-09-04  0:00         ` Robert Dewar
1999-09-05  0:00           ` Francois Godme
1999-09-06  0:00             ` Robert Dewar
1999-09-06  0:00               ` Francois Godme
1999-09-06  0:00                 ` Robert Dewar
1999-09-06  0:00                 ` Robert Dewar
1999-09-06  0:00                   ` Bob Collins
1999-09-07  0:00                     ` Pascal Obry
1999-09-07  0:00                 ` Pascal Obry
1999-09-07  0:00                   ` Francois Godme
1999-09-08  0:00                   ` Francois Godme
1999-09-04  0:00       ` Mario Klebsch
1999-09-05  0:00         ` Robert Dewar
1999-09-06  0:00           ` Francois Godme
1999-09-05  0:00             ` Brian Rogoff
1999-09-06  0:00             ` Robert Dewar
1999-09-08  0:00               ` Georg Bauhaus
1999-09-05  0:00       ` Geoff Bull
1999-09-07  0:00       ` Michael F. Yoder
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox