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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Unchecked_Union record inside an other record - trouble Date: Fri, 08 Aug 2014 18:36:48 +0300 Organization: Aioe.org NNTP Server Message-ID: NNTP-Posting-Host: AnnUDmZwVERVUXyHDyOl5A.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.12.4 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:21559 Date: 2014-08-08T18:36:48+03:00 List-Id: I am trying to interface my program with a C library. The below program does not compile: main.adb:19:14: unconstrained subtype in component declaration If this does not work, what should I do to interface a union inside a struct in a C library? -- main.adb with Interfaces.C; use Interfaces.C; procedure Main is type Kind is (First, Second); type T(K: Kind) is record case K is when First => I: int; when Second => C: char; end case; end record with Unchecked_Union, Convention=>C; type T2 is record Z: int; Ob: T; end record with Convention=>C; begin null; end; -- Victor Porton - http://portonvictor.org