comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@gmail.com>
Subject: Re: Interface with C codes
Date: Mon, 20 Oct 2014 09:14:23 -0700 (PDT)
Date: 2014-10-20T09:14:23-07:00	[thread overview]
Message-ID: <4682122f-373b-42c5-808e-6eb6026fc7cb@googlegroups.com> (raw)
In-Reply-To: <add0a768-629b-4b87-986e-8e672bc4bb27@googlegroups.com>

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 has a pointer in it, and a C struct that does not have a pointer. 

> 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, 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 expecting 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 already addressed this by suggesting you change Boot_Dev's type to Char_Array.  

                                -- Adam

  parent reply	other threads:[~2014-10-20 16:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17 23:22 Interface with C codes Anh Vo
2014-10-17 23:30 ` Anh Vo
2014-10-18 18:33   ` Stephen Leake
2014-10-19  4:33     ` Anh Vo
2014-10-19  9:24       ` Simon Clubley
2014-10-19 11:46       ` Brian Drummond
2014-10-19 13:58         ` Simon Wright
2014-10-19 17:33           ` Anh Vo
2014-10-17 23:49 ` Adam Beneschan
2014-10-18  0:04   ` Anh Vo
2014-10-18  1:04     ` Anh Vo
2014-10-20 16:14     ` Adam Beneschan [this message]
2014-10-25  3:31       ` Anh Vo
2014-10-18  2:20 ` Jeffrey Carter
2014-10-18 17:00   ` Anh Vo
2014-10-18  6:27 ` Per Sandberg
2014-10-18 17:08   ` Anh Vo
2014-10-18 17:12     ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox