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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!news.dns-netz.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!85.12.16.69.MISMATCH!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx10.am4.POSTED!not-for-mail Subject: Re: How to bind this properly, C ** which is an array Newsgroups: comp.lang.ada References: <1bb2318a-eb48-450f-908d-a304b92bd74c@googlegroups.com> From: Per Sandberg User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <1bb2318a-eb48-450f-908d-a304b92bd74c@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@usenet.se NNTP-Posting-Date: Fri, 01 Mar 2019 19:57:15 UTC Organization: usenet.se Date: Fri, 1 Mar 2019 20:57:15 +0100 X-Received-Bytes: 2080 X-Received-Body-CRC: 1755722066 Xref: reader01.eternal-september.org comp.lang.ada:55752 Date: 2019-03-01T20:57:15+01:00 List-Id: Well i would start with: gcc -c -fdump-ada-spec ${headerfile} [-fada-spec-parent=${a-good-root}] to have the compiler do all the tricky work, if the headers are "bad" you might need to do som touch-ups but that could usually be done with some simple sed-scripts. /P On 3/1/19 2:48 PM, Lucretia wrote: > Hi, > > I'm trying to bind the following struct: > > typedef struct mpc_ast_t { > char *tag; > char *contents; > mpc_state_t state; > int children_num; > struct mpc_ast_t** children; > } mpc_ast_t; > > I have this: > > type ASTs is > record > Tag : C.Strings.chars_ptr; > Contents : C.Strings.chars_ptr; > State : States; > Number_Of_Children : C.int; > Children : System.Address; -- Pointer to a pointer to an array of ASTs. > end record with > Convention => C; > > Children needs to be accessed in code as a pointer to a pointer to an array of ASTs. > > How do I best bind this thing? It's likely going to have to be converted from Address to a particular type using Unchecked_Conversion most likely. > > Thanks, > Luke. >