comp.lang.ada
 help / color / mirror / Atom feed
* Unchecked_Union record inside an other record - trouble
@ 2014-08-08 15:36 Victor Porton
  2014-08-08 16:01 ` Adam Beneschan
  2014-08-08 19:21 ` Per Sandberg
  0 siblings, 2 replies; 17+ messages in thread
From: Victor Porton @ 2014-08-08 15:36 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-08-10  7:25 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-08 15:36 Unchecked_Union record inside an other record - trouble Victor Porton
2014-08-08 16:01 ` Adam Beneschan
2014-08-08 16:56   ` Victor Porton
2014-08-08 18:52     ` Shark8
2014-08-08 19:56       ` Victor Porton
2014-08-08 20:06         ` Pascal Obry
2014-08-08 20:09         ` Shark8
2014-08-08 20:12           ` Victor Porton
2014-08-08 20:22             ` Shark8
2014-08-08 20:28               ` Victor Porton
2014-08-08 21:07                 ` Shark8
2014-08-08 19:52   ` Victor Porton
2014-08-08 19:57     ` Adam Beneschan
2014-08-08 19:21 ` Per Sandberg
2014-08-08 20:01   ` Victor Porton
2014-08-08 21:23   ` Jeffrey Carter
2014-08-10  7:25     ` Per Sandberg

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