From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Interfacing between Ada and C: records and structs
Date: Wed, 1 Aug 2012 21:39:46 -0700 (PDT)
Date: 2012-08-01T21:39:46-07:00 [thread overview]
Message-ID: <6ba3c3f2-0cb6-454e-a61d-ebdd4e51528a@googlegroups.com> (raw)
In-Reply-To: <5813d3d2-8a9f-4a08-bf09-db3c62847593@googlegroups.com>
> Digging into the POSIX module:
>
>
>
> private
>
> type Dummy is tagged null record;
>
> type Mutex is record
>
> Mutex : aliased POSIX.C.pthread_mutex_t;
>
> D : Dummy;
>
> end record
>
>
>
> >
>
> > Have you checked that in Ada, pthread_mutex_t'Size is 192?
>
> >
>
>
>
> In the POSIX.C package:
>
> ALIGNMENT : constant := Natural'Min(Standard'Maximum_Alignment, 8);
>
> type pthread_mutex_t'Alignment use ALIGNMENT;
>
> type pthread_mutex_t'Size use 192;
>
>
>
> However, when I write a simple test program I get 256 bits from 'Size, I'm not sure why...
Try adding Pragma Pack( DATA_STRUCTURE ); to the record.
next prev parent reply other threads:[~2012-08-07 6:44 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
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 [this message]
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