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 2002:a24:dd0d:: with SMTP id t13-v6mr14205006itf.6.1537225062084; Mon, 17 Sep 2018 15:57:42 -0700 (PDT) X-Received: by 2002:aca:d417:: with SMTP id l23-v6mr204750oig.7.1537225061995; Mon, 17 Sep 2018 15:57:41 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.215.MISMATCH!x188-v6no9245ite.0!news-out.google.com!z5-v6ni13ite.0!nntp.google.com!x81-v6no9452ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 17 Sep 2018 15:57:41 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=121.45.194.120; posting-account=d51RWwoAAADvR-x0zYAtT9z3CRxT1eXo NNTP-Posting-Host: 121.45.194.120 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7390d65b-fc95-4aff-bcb2-966516ee879b@googlegroups.com> Subject: Re: Interface To C Struct That Includes An Array From: Roger Injection-Date: Mon, 17 Sep 2018 22:57:42 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:54351 Date: 2018-09-17T15:57:41-07:00 List-Id: On Tuesday, September 18, 2018 at 2:29:20 AM UTC+10, Jeffrey R. Carter wrote: > On 09/17/2018 02:01 PM, rogermc@iinet.net.au wrote: > > > > (gdb) print Assimp_Path > > $8 = (length => 16, data => (0 => 11, 0, 0, 0, 112, 104, 111, 101, 110, 105, 120, 46, 112, 99, 120, 0 ) > > I have no idea what I'm talking about, so this may be totally useless, but the > 11 0 0 0 at the beginning looks like it might be some sort of encoding marker. > The first of the 1009 (or is it 1010?) zeros at the end is in position 16 (index > 15), so I presume it's the C string terminator. > > -- > Jeff Carter > "Oh Lord, bless this thy hand grenade, that with it thou > mayst blow thine enemies to tiny bits, in thy mercy." > Monty Python and the Holy Grail > 24 The expected data size is 1024, the first character of which is the 112. The 11 IS the size of the character string 112, 104, 111, 101, 110, 105, 120, 46, 112, 99, 120, the last 0 being the (null) string terminator. The remaining 1009 (or is it 1010?) zeros are just unused character spaces that were initialized with nulls. The 16 seems to indicate that the whole of the expected data structure (length and data) have been interpreted (somewhere) as data and the 16 is the length of the "data". I'm wondering if, somehow the "thing" might be a struct containing the required struct: struct length. (16) struct length. (11) data (character string) There is another C routine that I call that returns the API_String record (struct) correctly. This correctly returned API_String struct is actually part of another larger structure.