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.95.103 with SMTP id dj7mr11156866obb.22.1414207895288; Fri, 24 Oct 2014 20:31:35 -0700 (PDT) X-Received: by 10.50.79.231 with SMTP id m7mr95738igx.11.1414207895147; Fri, 24 Oct 2014 20:31:35 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h18no9677048igc.0!news-out.google.com!rp1ni2638igb.0!nntp.google.com!uq10no17145385igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 24 Oct 2014 20:31:34 -0700 (PDT) In-Reply-To: <4682122f-373b-42c5-808e-6eb6026fc7cb@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.6.21.101; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 24.6.21.101 References: <7dec5a01-4376-4f86-b4f3-b28948474828@googlegroups.com> <4682122f-373b-42c5-808e-6eb6026fc7cb@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <98c0c6c4-ec0f-45b0-89f1-a0592be7881b@googlegroups.com> Subject: Re: Interface with C codes From: Anh Vo Injection-Date: Sat, 25 Oct 2014 03:31:35 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:22717 Date: 2014-10-24T20:31:34-07:00 List-Id: On Monday, October 20, 2014 9:14:25 AM UTC-7, Adam Beneschan wrote: > On Friday, October 17, 2014 5:04:17 PM UTC-7, Anh Vo wrote: >=20 >>> 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 >=20 >> The second parameter of the function prototype use pointer, BOOT_PARAMS = * pBootParams. >=20 > My point was that if you have a record layout in Ada that has a pointer i= n it, and your record (struct) type definition in C doesn't have a pointer,= there 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 expect= ing those bytes to be character data (and since it actually expects there t= o be 20 characters, it will be looking for character data past the end of t= he Ada record, possibly looking into other Ada variables or worse). Jeff a= lready addressed this by suggesting you change Boot_Dev's type to Char_Arra= y. =20 >=20 You are right. I ended up to use the g++ -fdump-ada-spec suggested by Per S= andberg and others. Yes, the Boot_Dev's is defined Char_Array type. The goo= d news is that it worked good. Again, thank you all for your help. Anh Vo