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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.121.232 with SMTP id ln8mr18278211obb.11.1400545351801; Mon, 19 May 2014 17:22:31 -0700 (PDT) X-Received: by 10.50.92.34 with SMTP id cj2mr7752igb.4.1400545351716; Mon, 19 May 2014 17:22:31 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!hl10no1532925igb.0!news-out.google.com!qf4ni5721igc.0!nntp.google.com!c1no10917329igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 19 May 2014 17:22:31 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: <0f62af38-2a08-4d5c-bc74-c0dde56eb8f4@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <146ca0d2-e2d1-49a3-bbdf-56b385db0bef@googlegroups.com> Subject: Re: How to import C pointers to structures? From: Adam Beneschan Injection-Date: Tue, 20 May 2014 00:22:31 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:19914 Date: 2014-05-19T17:22:31-07:00 List-Id: On Monday, May 19, 2014 5:10:14 PM UTC-7, Shark8 wrote: > On 19-May-14 16:44, Adam Beneschan wrote: >=20 > >> You generally *can't* do a real/meaningful import w/o knowing the > >> layout. >=20 > > I'm not sure that's quite true ... there are lots of situations > > where you simply want to "pass through" a pointer, e.g. in > > callback situations, where a function sets up a callback and says > > "when you do the callback, please pass this pointer to it"; and > > whoever registers the callback will take the pointer, store it > > somewhere, and use it when it's needed, without ever trying to > > look at what it points to. >=20 > While those are /common/ cases, I would be hesitant to call them=20 > /general/ cases. >=20 > > Unfortunately, I don't see the equivalent of "void *" anywhere in > > Interfaces.C, which is what the sort of thing you'd want. You > > could probably use Interfaces.C.Strings.chars_ptr (the equivalent > > of "char *"). >=20 > Instantiate Interfaces.C.Pointers on a null-record or, perhaps,=20 > System.Address? I wouldn't trust System.Address; there's no guarantee that the Ada implemen= tation of this Ada type is represented the same way as a C pointer, an Ada = access object, or anything else. The first idea, to instantiate Interfaces= .C.Pointers, should be trustworthy--that's an excellent idea. -- Adam