From: nebbe@lglsun.epfl.ch (Robb Nebbe)
Subject: Re: Interfaces.C
Date: 2 Nov 1994 13:34:17 GMT
Date: 1994-11-02T13:34:17+00:00 [thread overview]
Message-ID: <1994Nov2.142450@lglsun.epfl.ch> (raw)
In-Reply-To: 395o3q$2j1@wynkyn.ecs.soton.ac.uk
In article <395o3q$2j1@wynkyn.ecs.soton.ac.uk>, kst@ecs.soton.ac.uk (Ken Thomas) writes:
|> I am attempting to write an Ada9X interface for a C function
|> with specification
|>
|> void foo(int *a, int l)
|>
|> the aim being to pass an integer array to the C-function. What is the
|> correct usage of the package Interfaces.C and its children?
|>
If you just want to pass parameters to the C function you would write:
type Int_Array is array( Natural range <> ) of C.int
-- the range could be anything but C will treat it as starting at 0
procedure foo( a : in Int_Array; l : in C.int );
pragma Import( C, foo );
The array a will be passed by reference and l by value automatically.
The rules for how parameters are passed to a C program are defined
in Ada9x making it easy to abstract away from C's low-level calling
interface.
- Robb Nebbe
next prev parent reply other threads:[~1994-11-02 13:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-11-01 15:50 Interfaces.C Ken Thomas
1994-11-01 22:45 ` Interfaces.C Dale Stanbrough
1994-11-02 13:34 ` Robb Nebbe [this message]
1994-11-06 1:15 ` Interfaces.C Dale Stanbrough
-- strict thread matches above, loose matches on Subject: below --
1996-08-10 0:00 Interfaces.C David Krovich
1996-08-11 0:00 ` Interfaces.C David C. Hoos, Sr.
1996-08-14 0:00 ` Interfaces.C Mike Fair
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox