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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1b043921d2cf45d2 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!feeder.erje.net!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Interfacing to C without dynamic memory Date: Fri, 14 Nov 2008 19:12:33 -0600 Organization: Jacob's private Usenet server Message-ID: References: <8a0e9a41-6670-486b-bbb7-7ef706643930@a17g2000prm.googlegroups.com> <491de115$0$29376$426a74cc@news.free.fr> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1226711579 26312 69.95.181.76 (15 Nov 2008 01:12:59 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sat, 15 Nov 2008 01:12:59 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news2.google.com comp.lang.ada:8409 Date: 2008-11-14T19:12:33-06:00 List-Id: ... > 3. Wrap imported C functions by passing to them the 'Address of T's > instances. You were fine up to here. But there is no reason at all to do this; you can use 'Access and a general access type with the appropriate convention; 'Access and an anonymous access type, or best of all, just plain parameters (which will be passed by reference for routines with the C convention). An Ada 95 or newer program that uses System.Address outside of address clauses is broken, IMHO. There are many safer ways to do those things. (And avoiding access types is good, too.) For Claw, most of the interfaces use locally declared records with the StdCall convention (and all of the components defined by Win32), and usually normal 'in' and 'in out' parameters. The only access parameters that we used was in functions that modified some of their arguments (and that was only because of Ada's broken rule against 'in out' parameters in functions). Randy. Randy.