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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d23826ff0acb491b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!q7g2000yqi.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: Gem 39 - compiler specific? Date: Sat, 5 Sep 2009 23:54:50 -0700 (PDT) Organization: http://groups.google.com Message-ID: <8f30ae6d-29b7-4eb3-809d-70669cb22eea@q7g2000yqi.googlegroups.com> References: <9e0bbbcd-260f-48ed-8043-d6280c633e85@h3g2000yqa.googlegroups.com> <19268dbw82hf4.aii8as09aapk.dlg@40tude.net> <4bff103b-1797-4e2b-9dcf-7466b667c59b@d9g2000prh.googlegroups.com> <1s8kuin5t96vr$.1taw9mluqlplz$.dlg@40tude.net> <1bf4b63a-1e2d-41f1-97c6-8324d4b829ff@z3g2000prd.googlegroups.com> <6o3frhrv0n0p$.8wj0gszs5h07$.dlg@40tude.net> <1udpwiw4u1cj5$.ff4ssnbb90vn$.dlg@40tude.net> <79b62678-84b6-49a2-a943-2212658bedfe@l9g2000yqi.googlegroups.com> NNTP-Posting-Host: 82.30.110.254 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1252220090 31113 127.0.0.1 (6 Sep 2009 06:54:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 6 Sep 2009 06:54:50 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q7g2000yqi.googlegroups.com; posting-host=82.30.110.254; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8191 Date: 2009-09-05T23:54:50-07:00 List-Id: On Sep 5, 9:45=A0pm, Maciej Sobczak wrote: > You meant pragma Import (C, P); Yes > B.3/68: > > "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." > > This is the only guarantee concerning access types when interfacing > with C. > The paragraph is clearly constrained to those types that have some > corresponding type on the C side. For example access to > Interfaces.C.int will be passed as int*. > But I see nothing about access to types that have no C counterpart. In > particular, access values to class-wide types are not covered at all. > > This is the reason why I think that passing address (seen as void* on > the C side) is the proper way. > All corrections to this reasoning are highly welcome. The last time I had to do something like this, I said something like with Ada.Streams; package Accessing is type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class; for Stream_Access'Size use 32; procedure Pass (SA : Stream_Access); pragma Import (C, Pass); end Accessing; but that was a long time ago, and GNAT now says accessing.ads:7:20: warning: "Pass.SA" involves a tagged type which does not correspond to any C type which is a pretty strong hint!