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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8ecbc35ea893182f X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.germany.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Interfacing to C: big structures Date: Tue, 26 Feb 2008 16:19:45 +0100 Message-ID: <62ip0mF23cobbU1@mid.individual.net> References: <62idb0F23ddfnU1@mid.individual.net> Reply-To: alejandro@mosteo.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net MQL2hbhTo9c6lenO5zonYQZO4xx+wT/nVAF89y2Vd0MYmpyCE= Cancel-Lock: sha1:LF4ukef8QGnN/XjEJHmbgbZj+y0= User-Agent: Thunderbird 2.0.0.6 (X11/20071022) In-Reply-To: Xref: g2news1.google.com comp.lang.ada:20093 Date: 2008-02-26T16:19:45+01:00 List-Id: Robert A Duff wrote: > "Alex R. Mosteo" writes: > >> 2. Create an Ada type as >> >> type S is new Ada.Streams.Stream_Element_Array >> (1 .. Stream_Offset (Size_Of_S)); >> pragma Pack (S); -- Not sure if this is even needed. >> >> Note that this type gets its size at elaboration time, and thus this is >> what fixes this type if the C corresponding struct changes. > > Nice trick. > > But I think you need to make sure the alignment is correct. I'm out of my expertise here, but why it's that necessary? In the end you're passing S address to the C subprograms and I don't see how alignment may have influence (but, again, I don't know about this).