comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Import a type from C
Date: 06 Nov 2002 18:10:12 -0500
Date: 2002-11-06T23:21:11+00:00	[thread overview]
Message-ID: <u7kfqjnvv.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: hDey9.33529$7W2.7993@nwrddc01.gnilink.net

"Frank J. Lhota" <NOSPAM.lhota.adarose@verizon.net> 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



  reply	other threads:[~2002-11-06 23:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-06 19:48 Import a type from C Francisco Santoyo
2002-11-06 20:06 ` Frank J. Lhota
2002-11-06 23:10   ` Stephen Leake [this message]
2003-01-08 20:46     ` Rupert Pigott
2003-01-10  3:48       ` Eric G. Miller
2003-01-14  4:47       ` David Thompson
2002-11-07  7:16 ` Victor Porton
2002-11-07 13:47   ` Stephen Leake
2002-11-07 16:03   ` Frank J. Lhota
2002-11-07 16:20     ` Robert A Duff
2002-11-08 14:51       ` Stephen Leake
2002-11-07 19:00 ` chris.danx
2002-11-08  4:02 ` Victor Porton
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox