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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 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!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!fx06.iad.POSTED!not-for-mail From: Shark8 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:32.0) Gecko/20100101 Thunderbird/32.0a1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How to import C pointers to structures? References: <0f62af38-2a08-4d5c-bc74-c0dde56eb8f4@googlegroups.com> In-Reply-To: <0f62af38-2a08-4d5c-bc74-c0dde56eb8f4@googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Tue, 20 May 2014 00:10:15 UTC Organization: TeraNews.com Date: Mon, 19 May 2014 18:10:14 -0600 X-Received-Bytes: 1790 X-Received-Body-CRC: 2499315936 Xref: news.eternal-september.org comp.lang.ada:19913 Date: 2014-05-19T18:10:14-06:00 List-Id: On 19-May-14 16:44, Adam Beneschan wrote: >> You generally *can't* do a real/meaningful import w/o knowing the >> layout. > > 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. While those are /common/ cases, I would be hesitant to call them /general/ cases. > 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 *"). Instantiate Interfaces.C.Pointers on a null-record or, perhaps, System.Address?