comp.lang.ada
 help / color / mirror / Atom feed
From: Per Sandberg <per.s.sandberg@bahnhof.se>
Subject: Re: How to bind this properly, C ** which is an array
Date: Fri, 1 Mar 2019 23:02:24 +0100
Date: 2019-03-01T23:02:24+01:00	[thread overview]
Message-ID: <QZheE.7542$uD1.4275@fx33.am4> (raw)
In-Reply-To: <08d6e0ce-52d9-47ff-a0a0-d0ec187399c0@googlegroups.com>

 From the source provided i would guss that the folowing is a correct 
spec-file.
------------------------------------------------------------
pragma Ada_2012;
pragma Style_Checks (Off);

with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;

package xx_h is

    type mpc_state_ti is record
       null;
    end record
    with Convention => C_Pass_By_Copy;  -- xx.h:1

    subtype mpc_state_t is mpc_state_ti;  -- xx.h:1

    type mpc_ast_t;
    type mpc_ast_t_access is access all  mpc_ast_t;
    type mpc_ast_t is record
       tag : Interfaces.C.Strings.chars_ptr;  -- xx.h:4
       contents : Interfaces.C.Strings.chars_ptr;  -- xx.h:5
       state : aliased mpc_state_t;  -- xx.h:6
       children_num : aliased int;  -- xx.h:7
       children : access mpc_ast_t_access;  -- xx.h:8
    end record
    with Convention => C_Pass_By_Copy;  -- xx.h:3

end xx_h;
------------------------------------------------------------
/P

On 3/1/19 9:25 PM, Lucretia wrote:
> On Friday, 1 March 2019 19:57:17 UTC, Per Sandberg  wrote:
>> Well i would start with:
>>
>> gcc -c -fdump-ada-spec ${headerfile} [-fada-spec-parent=${a-good-root}]
>>
>> to have the compiler do all the tricky work, if the headers are "bad"
>> you might need to do som touch-ups but that could usually be done with
>> some simple sed-scripts.
> 
> I already did, it just generates what I originally had, Address.
> 

  reply	other threads:[~2019-03-01 22:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 13:48 How to bind this properly, C ** which is an array Lucretia
2019-03-01 13:54 ` Björn Lundin
2019-03-01 13:59   ` Lucretia
2019-03-01 14:02 ` Dmitry A. Kazakov
2019-03-01 14:20   ` Lucretia
2019-03-01 19:57 ` Per Sandberg
2019-03-01 20:25   ` Lucretia
2019-03-01 22:02     ` Per Sandberg [this message]
2019-03-01 23:42       ` Lucretia
replies disabled

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