From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1726119712bbda0d X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: Interfacing to C non-void procedure with "out" parameters Date: 2000/01/14 Message-ID: <85nurq$cr0$1@nnrp1.deja.com>#1/1 X-Deja-AN: 572668382 References: <387f1c30.12554815@news.rdg.ac.uk> <85ngl3$10s$1@nnrp1.deja.com> <85nqaf$95o$1@nnrp1.deja.com> X-Http-Proxy: 1.0 x35.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Jan 14 19:53:38 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I) Date: 2000-01-14T00:00:00+00:00 List-Id: In article <85nqaf$95o$1@nnrp1.deja.com>, Jeff Carter wrote: > In article <85ngl3$10s$1@nnrp1.deja.com>, > Ted Dennison 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.