From: Anh Vo <anhvofrcaus@gmail.com>
Subject: Re: Interface with C codes
Date: Sat, 18 Oct 2014 10:00:47 -0700 (PDT)
Date: 2014-10-18T10:00:47-07:00 [thread overview]
Message-ID: <97ee0666-0b33-4e6c-b777-fcef44eb95fd@googlegroups.com> (raw)
In-Reply-To: <m1sipm$ead$1@dont-email.me>
On Friday, October 17, 2014 7:20:45 PM UTC-7, Jeffrey Carter wrote:
> On 10/17/2014 04:22 PM, Anh Vo wrote:
>
> > What Ada spec should be for the following C prototype where BOOT_PARAMS is a struct and responding Ada type is
> >
> > type Boot_Parameter_Type is
> > record
> > Boot_Dev : Interfaces.C.Strings.Chars_Ptr;
> This doesn't match the C quoted below. Use
> Interfaces.C.Char_Array (0 .. 19);
Thanks for that.
>
> > -- ...
>
> > end record;
> > pragma Convention (C, Boot_Parameter_Type);
> >
> > type Boot_Parameter_Type_Access is access Boot_Parameter_Type;
> > pragma Convention (C, Boot_Parameter_Type_Access);
>
> You don't need this access type.
>
> > char * bootStringToStruct (char * bootString, BOOT_PARAMS * pBootParams);
>
> I would probably use
> function To_Record
> (Boot_String : Intefaces.C.Char_Array; Boot_Parameter : Boot_Parameter_Type)
> return Interfaces.C.Strings.Chars_Ptr;
> and rely on the advice in B.3(69-70): both parameters will be passed by reference.
Thanks again. I have enough info to test it out.
Anh Vo
next prev parent reply other threads:[~2014-10-18 17:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-17 23:22 Interface with C codes Anh Vo
2014-10-17 23:30 ` Anh Vo
2014-10-18 18:33 ` Stephen Leake
2014-10-19 4:33 ` Anh Vo
2014-10-19 9:24 ` Simon Clubley
2014-10-19 11:46 ` Brian Drummond
2014-10-19 13:58 ` Simon Wright
2014-10-19 17:33 ` Anh Vo
2014-10-17 23:49 ` Adam Beneschan
2014-10-18 0:04 ` Anh Vo
2014-10-18 1:04 ` Anh Vo
2014-10-20 16:14 ` Adam Beneschan
2014-10-25 3:31 ` Anh Vo
2014-10-18 2:20 ` Jeffrey Carter
2014-10-18 17:00 ` Anh Vo [this message]
2014-10-18 6:27 ` Per Sandberg
2014-10-18 17:08 ` Anh Vo
2014-10-18 17:12 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox