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.88.168 with SMTP id bh8mr1479477pab.10.1344322802267; Tue, 07 Aug 2012 00:00:02 -0700 (PDT) Path: p10ni243pbh.1!nntp.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.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: awdorrin Newsgroups: comp.lang.ada Subject: Re: Interfacing between Ada and C: records and structs Date: Tue, 31 Jul 2012 11:44:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: <5813d3d2-8a9f-4a08-bf09-db3c62847593@googlegroups.com> References: <296e271a-967b-4dfb-8dca-f278ecfae03d@googlegroups.com> NNTP-Posting-Host: 192.91.173.36 Mime-Version: 1.0 X-Trace: posting.google.com 1343760594 18753 127.0.0.1 (31 Jul 2012 18:49:54 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 31 Jul 2012 18:49:54 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=192.91.173.36; posting-account=YkFdLgoAAADpWnfCBA6ZXMWTz2zHNd0j User-Agent: G2/1.0 X-Received-Bytes: 2736 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-07-31T11:44:11-07:00 List-Id: On Tuesday, July 31, 2012 1:16:10 PM UTC-4, Niklas Holsti wrote: > > How is pthread_mutex_t declared in Ada form? And in C form? > 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... But that is probably the source of my problem. > > What is the storage unit of your target processor? 8 bits? The system is an Intel core2Duo E4600 - so a 64bit processor running x86_64 variant of Debian. (32-bit mode) So the storage unit is 8 bits. > > That is a strange alignment. Do you see any need for it? If not, try > removing it. That was a typo on my part, should have read 'Alignment use 8; > > Do you see any need for this representation clause? If not, remove it. > > Or change it to use 192 bits per component. That is the output from the -gnatR3 parameter, I don't have the rep spec defined in the code. > > (What are the "-" characters after the "at" keywords? Shouldn't it read > "at 0 range"?) Sorry, that was apparently another typo on my part. (Cut and paste isn't working between my Linux VNC session and my desktop Windows PC)