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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no 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 12:06:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!washdc3-snf1!news.gtei.net!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc01.gnilink.net.POSTED!53ab2750!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: Subject: Re: Import a type from C X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: Date: Wed, 06 Nov 2002 20:06:37 GMT NNTP-Posting-Host: 141.157.179.116 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc01.gnilink.net 1036613197 141.157.179.116 (Wed, 06 Nov 2002 15:06:37 EST) NNTP-Posting-Date: Wed, 06 Nov 2002 15:06:37 EST Xref: archiver1.google.com comp.lang.ada:30483 Date: 2002-11-06T20:06:37+00:00 List-Id: 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.