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.241.2 with SMTP id we2mr19378627obc.38.1413821664313; Mon, 20 Oct 2014 09:14:24 -0700 (PDT) X-Received: by 10.50.152.10 with SMTP id uu10mr217601igb.1.1413821664225; Mon, 20 Oct 2014 09:14:24 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!uq10no14351976igb.0!news-out.google.com!bc9ni31795igb.0!nntp.google.com!h18no8011677igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 20 Oct 2014 09:14:23 -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: <7dec5a01-4376-4f86-b4f3-b28948474828@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4682122f-373b-42c5-808e-6eb6026fc7cb@googlegroups.com> Subject: Re: Interface with C codes From: Adam Beneschan Injection-Date: Mon, 20 Oct 2014 16:14:24 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:22611 Date: 2014-10-20T09:14:23-07:00 List-Id: On Friday, October 17, 2014 5:04:17 PM UTC-7, Anh Vo wrote: > > I'm confused. You've defined an Ada record Boot_Parameter_Type that ha= s a pointer in it, and a C struct that does not have a pointer.=20 > The second parameter of the function prototype use pointer, BOOT_PARAMS *= pBootParams. My point was that if you have a record layout in Ada that has a pointer in = it, and your record (struct) type definition in C doesn't have a pointer, t= here will be major problems. The Ada program will pass a record that has (= typically) 4 or 8 bytes of pointer data, but the C program will be expectin= g those bytes to be character data (and since it actually expects there to = be 20 characters, it will be looking for character data past the end of the= Ada record, possibly looking into other Ada variables or worse). Jeff alr= eady addressed this by suggesting you change Boot_Dev's type to Char_Array.= =20 -- Adam