comp.lang.ada
 help / color / mirror / Atom feed
From: David Shochat <shochat@itg-sepg.logicon.com>
Subject: Re: Help - Call C function (with out parameter) from ADA95
Date: 1996/10/11
Date: 1996-10-11T00:00:00+00:00	[thread overview]
Message-ID: <325EE2C6.1D90@itg-sepg.logicon.com> (raw)
In-Reply-To: 01bbb779$7d989ca0$0e39e382@caeepc1.cri.dk


Mikael Espersen wrote:
> 
> Hi,
> 
> Does anyone know how to call a C function with out a parameter from ADA95.
> As far as I know ADA is only allowing in parameters to functions. The C
> function also has a return value so I can't declare as a procedure. Any
> help would be appreciated Thanks in advance.
> 
> Eks. (C program code)
> 
> int InitArray(char* arr);

Seems to me that would just be:

function InitArray (Arr : in Interfaces.C.Strings.chars_ptr) return
Interfaces.C.int;

C doesn't have "out" parameters. In C everything is passed by value. One
gets the effect of call by reference by explicitly passing a pointer (by
value). Your InitArray() looks kind of dangerous since it doesn't have a
parameter to limit the number of characters it writes.
-- David




      parent reply	other threads:[~1996-10-11  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-11  0:00 Help - Call C function (with out parameter) from ADA95 Mikael Espersen
1996-10-11  0:00 ` Robert Dewar
1996-10-11  0:00 ` David Shochat [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