comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: How to import C pointers to structures?
Date: Tue, 20 May 2014 07:36:45 +0100
Date: 2014-05-20T07:36:45+01:00	[thread overview]
Message-ID: <lyegzp3qiq.fsf@pushface.org> (raw)
In-Reply-To: 146ca0d2-e2d1-49a3-bbdf-56b385db0bef@googlegroups.com

Adam Beneschan <adambeneschan@gmail.com> writes:

> I wouldn't trust System.Address; there's no guarantee that the Ada
> implementation of this Ada type is represented the same way as a C
> pointer, an Ada access object, or anything else

AdaCore have Interfaces.C.Extensions which has

   --  Definitions for C "void" and "void *" types

   subtype void     is System.Address;
   subtype void_ptr is System.Address;

   --  Definitions for C incomplete/unknown structs

   subtype opaque_structure_def is System.Address;
   type opaque_structure_def_ptr is access opaque_structure_def;
   for opaque_structure_def_ptr'Storage_Size use 0;

   --  Definitions for C++ incomplete/unknown classes

   subtype incomplete_class_def is System.Address;
   type incomplete_class_def_ptr is access incomplete_class_def;
   for incomplete_class_def_ptr'Storage_Size use 0;

but it's their compiler on both sides so they know it's OK!


  reply	other threads:[~2014-05-20  6:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 22:26 How to import C pointers to structures? Victor Porton
2014-05-19 22:33 ` Shark8
2014-05-19 22:44   ` Adam Beneschan
2014-05-20  0:10     ` Shark8
2014-05-20  0:22       ` Adam Beneschan
2014-05-20  6:36         ` Simon Wright [this message]
2014-05-20  8:29 ` björn lundin
2014-05-20 19:07 ` Per Sandberg
2014-05-22 13:37   ` Stephen Leake
replies disabled

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