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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d8ff1403929a72c0 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.78.106 with SMTP id a10mr1508225pax.14.1344321863595; Mon, 06 Aug 2012 23:44:23 -0700 (PDT) Path: g9ni2910154pbo.0!nntp.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!ctu-peer!ctu-gate!news.nctu.edu.tw!usenet.stanford.edu!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: Interfacing between Ada and C: records and structs Date: Wed, 1 Aug 2012 21:39:46 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6ba3c3f2-0cb6-454e-a61d-ebdd4e51528a@googlegroups.com> References: <296e271a-967b-4dfb-8dca-f278ecfae03d@googlegroups.com> <5813d3d2-8a9f-4a08-bf09-db3c62847593@googlegroups.com> NNTP-Posting-Host: 69.20.190.126 Mime-Version: 1.0 X-Trace: posting.google.com 1343885090 20004 127.0.0.1 (2 Aug 2012 05:24:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 2 Aug 2012 05:24:50 +0000 (UTC) In-Reply-To: <5813d3d2-8a9f-4a08-bf09-db3c62847593@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-08-01T21:39:46-07:00 List-Id: > 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.