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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,57a1144bacb793b9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-10 19:46:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3EBDB959.3090406@spam.com> From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: C binding issue References: <20030511004621.63e7fbd9.david@realityrift.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 11 May 2003 02:44:00 GMT NNTP-Posting-Host: 63.184.8.46 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1052621040 63.184.8.46 (Sat, 10 May 2003 19:44:00 PDT) NNTP-Posting-Date: Sat, 10 May 2003 19:44:00 PDT Xref: archiver1.google.com comp.lang.ada:37170 Date: 2003-05-11T02:44:00+00:00 List-Id: David C. Hoos wrote: > "kat-Zygfryd" <6667@wp.pl> wrote in message > news:b9k0rv$bls$1@news.onet.pl... > >> Thanks, I just thought that access types and C pointers are >> incompatible. > > Questions of this type are answered in the Ada Reference manual. > > This particular case is covered in B.3 (68), viz.: > > An Ada access T parameter, or an Ada out or in out parameter of an > elementary type T, is passed as a t* argument to a C function, where > t is the C type corresponding to the Ada type T. In the case of an > elementary out or in out parameter, a pointer to a temporary copy is > used to preserve by-copy semantics. This refers to access parameters; the example used a named access type. These can be made C-compatible by applying pragma Convention to them: type Void_Ptr is access all Integer; pragma Convention (C, Void_Ptr); -- Jeff Carter "Beyond 100,000 lines of code you should probably be coding in Ada." P. J. Plauger