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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6b77ce1ba18f9267 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-06 15:29:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Import a type from C Date: 06 Nov 2002 18:10:12 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1036624871 2910 128.183.235.92 (6 Nov 2002 23:21:11 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 6 Nov 2002 23:21:11 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:30489 Date: 2002-11-06T23:21:11+00:00 List-Id: "Frank J. Lhota" writes: > pragma Convention( C, My_Data ); > > The Convention pragma can be used to specify that this record type should be > laid out in the same way that a C compiler would. Note that "a C compiler" really means "the C compiler that the Ada compiler knows about, with its default command line args". For example, GNAT will assume Gnu C, _without_ -fpacked. ObjectAda probably assumes MS C, again without the "packed" flag. That has caused me some major problems, when linking against C code compiled _with_ the -fpacked flag. So I always use a rep spec, instead of relying on Convention (C). Then I write some C code that checks the struct size, to be sure there is no padding. -- -- Stephe