comp.lang.ada
 help / color / mirror / Atom feed
From: Per Sandberg <per.s.sandberg@bahnhof.se>
Subject: Re: How to import C pointers to structures?
Date: Tue, 20 May 2014 21:07:26 +0200
Date: 2014-05-20T21:07:26+02:00	[thread overview]
Message-ID: <537ba7ef$0$8750$862e30e2@ngroups.net> (raw)
In-Reply-To: <lle0dv$1gi$1@speranza.aioe.org>


Well
given that you are runnig a fairly GCC all the answers is in the compiler.

$echo "#include <your_interface.h>" >gen.cpp
$g++ -c -fdump-ada-spec gen.cpp
then you will get correct mapping:
your_interface.h <=> your_interface_h.ads

See:

https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gnat_ugn_unw/Running-the-binding-generator.html#Running-the-binding-generator
for more information.

To "generate" interfaces in any other way is inherently error-prone 
since humans tend to miss a lot of details.


/Per

On 20.05.2014 00:26, Victor Porton wrote:
> I've recently studied about the latest Ada standard (Ada2012) with the
> purpose to port librdf to Ada and then use it in my project.
>
> Suppose we have a C function:
>
> void f(struct_t *ptr);
>
> Here struct_t is a typedef which denotes an structure which layout should be
> considered unknown to us.
>
> How to import it to Ada? We don't know struct_t layout.
>


  parent reply	other threads:[~2014-05-20 19:07 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
2014-05-20  8:29 ` björn lundin
2014-05-20 19:07 ` Per Sandberg [this message]
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