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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ac6f6c30c45f808a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Ada equivalent for C-pointer? Date: Sun, 16 Jan 2005 09:44:21 +0100 Organization: None Message-ID: <1621573.egxgrGf4Ni@linux1.krischik.com> References: <41E7F653.2F899F47@alfred-hilscher.de> Reply-To: martin@krischik.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1105865413 02 24361 N91rrjSLqmkMQrv 050116 08:50:13 X-Complaints-To: usenet-abuse@t-online.de X-ID: rqKYzyZYgeVfMDD-JL1p5J+viuA8zoW3NTPIkBbUG09OhndQO2bH69 User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:7842 Date: 2005-01-16T09:44:21+01:00 List-Id: Nick Roberts wrote: > Pascal Obry wrote: > >> I don't think so. Here Number will be passed by value, no? > > No, I don't think so (with GNAT/GCC). > >> And you also need the returned value ;) > > Yes, oops! > >> So, you probably want: >> >> function Wibble (Number: access Interfaces.C.int) >> return Interfaces.C.int; >> >> pragma Import(C,Wibble,"wibble"); > > I think the 'in out' mode would work with GNAT/GCC, but I'd suggest > testing it to make sure. I did the testing - it does work > I suppose using the 'access' mode might be > clearer, and it might be slightly more efficient. Anonymous access efficient? If you have a copy read John Barnes Ada 95 (2nd edition), Page 190, 3rd chapter to end of page. Yes, I know, it does not apply to export/import C functions. Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com