comp.lang.ada
 help / color / mirror / Atom feed
From: awdorrin <awdorrin@gmail.com>
Subject: Re: Interfacing between Ada and C: records and structs
Date: Tue, 31 Jul 2012 12:08:10 -0700 (PDT)
Date: 2012-07-31T12:08:10-07:00	[thread overview]
Message-ID: <e01280a4-3d74-47da-860b-c9f7cb0d2739@googlegroups.com> (raw)
In-Reply-To: <5813d3d2-8a9f-4a08-bf09-db3c62847593@googlegroups.com>

I am wondering if the Dummy element in the Mutex record is not being treated as a null, but as a null pointer, adding 8 bytes to the record size.

I tried forcing the sizes to '192' in Ada by adding the rep spec and got the following error messages:

size for "LOCK_SHM_1" too small, minimum allowed is 224
position of aliased field "LOCK_SHM_1" must be multiple of 64 bits

So I'm guessing 192 (pthread_mutex_t) + 32 ( tagged null record) = 224 bits, rounded to 256 due to the address position requirement of an aliased field. (Still not sure I understand what a tagged or aliased field is, will have to read up on it.)

So, I guess this turns out to be more of a C question - on if I can pad/align the structs via compiler flags, or if I am better off sticking with manually adding the padding.

Not sure if there is a standard method used 'in modern times' to do this, other than defining a record in Ada and a corresponding struct in C.








  reply	other threads:[~2012-08-07  7:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 16:38 Interfacing between Ada and C: records and structs awdorrin
2012-07-31 17:16 ` Niklas Holsti
2012-07-31 18:44   ` awdorrin
2012-07-31 19:08     ` awdorrin [this message]
2012-07-31 19:27       ` Simon Wright
2012-07-31 19:44         ` awdorrin
2012-07-31 20:46           ` Niklas Holsti
2012-08-01 12:16             ` awdorrin
2012-07-31 19:23     ` Simon Wright
2012-08-02  4:39     ` Shark8
2012-08-02 12:32       ` awdorrin
     [not found] <7beb59ba-ca6f-476e-8b39-604196b0b79f@googlegroups.com>
2012-08-01  2:51 ` Jeffrey Carter
replies disabled

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