From: "Egil H. H�vik" <egil.harald.hoevik@REMOVEkongsberg.com>
Subject: Re: Interfacing with C: access/out parameters
Date: Tue, 31 Aug 2004 11:11:01 +0200
Date: 2004-08-31T11:11:01+02:00 [thread overview]
Message-ID: <41343c0e@193.71.169.73> (raw)
In-Reply-To: 41342a34@193.71.169.73
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]
"Egil H. H�vik" <egil.harald.hoevik@REMOVEkongsberg.com> wrote in message
news:41342a34@193.71.169.73...
>
> "Jano" <notelacreas@porfavor.no> wrote in message
> news:2ph6fjFkpsahU1@uni-berlin.de...
> > Hi,
> <snip>
> >
> > function Blah (Datum : access Data) return C.Int;
> > pragma Import (C, Blah);
> >
> >
> > Procedure Ada_Blah (Datum : out Data);
> > -- May raise some exception
> >
> > And my doubt, finally, is: can I ensure somehow that Datum is passed by
> > reference?, so I can do inside Ada_Blah [1]:
> >
> > Helper : aliased Datum;
> > For Helper'Address use Datum'Address;
> > if Thin_Package.Blah (Helper'Access) = Error_Value then
> > raise My_Error;
> > end if;
> >
>
> Well, you say Data is a record type, so what's wrong with:
>
> procedure Ada_Blah( Datum : out Data ) is
> function Blah( Datum : Data ) return C.int;
> pragma Import( C, Blah );
> begin
> if Thin_Package.Blah(Datum) = Error_Value then
hmm... Copy-Paste error here... Should be Blah(Datum), minus Thin_Package
> raise My_Error;
> end if;
> end Ada_Blah;
>
>
> B.3(65): "An Ada function corresponds to a non-void C function"
> B.3(69): "An Ada parameter of a record type T, of any mode, is passed as a
> t* argument
> to a C function, where t is the C type corresponding to the Ada type
T."
>
>
> ~egilhh
>
>
prev parent reply other threads:[~2004-08-31 9:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-30 17:30 Interfacing with C: access/out parameters Jano
2004-08-30 19:06 ` Jeffrey Carter
2004-08-31 9:41 ` Alex R. Mosteo
2004-08-31 9:48 ` Alex R. Mosteo
2004-08-31 18:26 ` Jeffrey Carter
2004-09-01 9:46 ` Alex R. Mosteo
2004-08-31 7:54 ` Egil H. H�vik
2004-08-31 9:11 ` Egil H. H�vik [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox