From: "Frank J. Lhota" <NOSPAM.lhota.adarose@verizon.net>
Subject: Re: Import a type from C
Date: Wed, 06 Nov 2002 20:06:37 GMT
Date: 2002-11-06T20:06:37+00:00 [thread overview]
Message-ID: <hDey9.33529$7W2.7993@nwrddc01.gnilink.net> (raw)
In-Reply-To: wmey9.336376$nc1.2504303@telenews.teleline.es
A C struct is basically the equivalent to an Ada record type, so if the C
type is declared as
typedef struct tag_my_data {
...
} my_data;
I would declare an Ada record type for that C struct, e.g..
type My_Data is
record
...
end record;
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. Also, check out the
Interfaces.C package. It defines types that correspond to C scalar types.
You should use this to declare the scalar components in the Ada equivalent
of the C struct.
If the type contains a C union, look up the Unchecked_Union pragma to see
how to write an equivalent Ada record type.
next prev parent reply other threads:[~2002-11-06 20:06 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 [this message]
2002-11-06 23:10 ` Stephen Leake
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