comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Mize <smize@link.com>
Subject: Re: Address to function pointer conversion
Date: 1997/06/17
Date: 1997-06-17T00:00:00+00:00	[thread overview]
Message-ID: <33A6EF3D.505EEF54@link.com> (raw)
In-Reply-To: dewar.866563840@merv


Robert Dewar wrote:
> 
> Sam says
> 
> <<I would agree EXCEPT -- dlsym is returning an address at run time,
> so you can't use pragma Import.  You still have the problem, how
> do you call this address from Ada?>>
> 
> No, on the Ada side the function which of course you Import (I don't
> understand your comment about not being able to use Import), returns
> an access to procedure value NOT an address.

I think I have put it together from several messages:

- You specify one or more access-to-function types, with
  Convention(C).  This way, whatever C uses as a pointer to a
  function -- in this case, an address -- can be called by
  Ada.  This is what I didn't see how to do, but someone else
  pointed it out.

- You import dlsym, which returns a pointer-to-function (an
  address).  You possibly do this several times if you expect
  it to return functions with different profiles.

Then you can call dlsym, and call what it returns.

Sam Mize

--
-- Samuel Mize    (817) 619-8622    smize@link.com    "Team Ada"
-- Hughes Training Inc.  PO Box 6171 m/s 400, Arlington TX 76005




  reply	other threads:[~1997-06-17  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-13  0:00 Address to function pointer conversion Michael Paus
1997-06-13  0:00 ` Samuel Mize
1997-06-14  0:00   ` Robert Dewar
1997-06-13  0:00 ` John G. Volan
1997-06-14  0:00   ` Robert Dewar
1997-06-17  0:00     ` John G. Volan
1997-06-20  0:00       ` Robert Dewar
1997-06-24  0:00         ` Matthew Heaney
1997-06-24  0:00           ` Robert Dewar
1997-06-25  0:00             ` Michael Paus
1997-06-14  0:00 ` Robert A Duff
1997-06-14  0:00 ` Robert Dewar
1997-06-16  0:00   ` Michael Paus
1997-06-16  0:00     ` Robert A Duff
1997-06-16  0:00     ` Robert Dewar
1997-06-16  0:00       ` Samuel Mize
1997-06-16  0:00         ` Robert A Duff
1997-06-17  0:00         ` Robert Dewar
1997-06-17  0:00           ` Samuel Mize [this message]
1997-06-20  0:00             ` Robert Dewar
1997-06-20  0:00             ` Robert Dewar
replies disabled

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