From: Ted Dennison <dennison@telepath.com>
Subject: Re: Interfacing to C non-void procedure with "out" parameters
Date: 2000/01/14
Date: 2000-01-14T00:00:00+00:00 [thread overview]
Message-ID: <85nurq$cr0$1@nnrp1.deja.com> (raw)
In-Reply-To: 85nqaf$95o$1@nnrp1.deja.com
In article <85nqaf$95o$1@nnrp1.deja.com>,
Jeff Carter <jrcarter001@my-deja.com> wrote:
> In article <85ngl3$10s$1@nnrp1.deja.com>,
> Ted Dennison <dennison@telepath.com> wrote:
> > First you interface to the routine to create your thin binding:
> >
> > function esGetValue (Key : in Interfaces.C.Int;
> > Value : in System.Address
> > ) return Interfaces.C.Int;
> > pragma Import (C, esGetValue, "esGetValue");
> There's no reason to use System.Address here. Use an access parameter:
If you mean doing a "Value : access Interfaces.C.Int", that is sometimes
doable. The problem with that is than many C interfaces, particularly
system calls, have optional pointer parameters where "null" is an
acceptable value. An access parameter does not allow "null" to be passed
in. So in general they aren't always useful
> > esGetValue
> > (Key => Interfaces.C.Int(Key),
> > Value => Value
> > ) = 0
>
> Note that the call here should not compile; Value is not of type
Yikes! You're right. It should read:
esGetValue
(Key => Interfaces.C.Int(Key),
Value => Value'address
) = 0
--
T.E.D.
http://www.telepath.com/~dennison/Ted/TED.html
Sent via Deja.com http://www.deja.com/
Before you buy.
next prev parent reply other threads:[~2000-01-14 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-14 0:00 Interfacing to C non-void procedure with "out" parameters Dr Steve Sangwine
2000-01-14 0:00 ` Alain Le Guennec
2000-01-14 0:00 ` Ted Dennison
2000-01-14 0:00 ` Jeff Carter
2000-01-14 0:00 ` Ted Dennison [this message]
2000-01-15 0:00 ` Jeff Carter
2000-01-17 0:00 ` Matthew Heaney
2000-01-18 0:00 ` Dr Steve Sangwine
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox