From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,23c28b14f995b7d4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-11-02 23:31:47 PST Path: bga.com!news.sprintlink.net!EU.net!Austria.EU.net!newsfeed.ACO.net!swidir.switch.ch!epflnews!dinews.epfl.ch!lglsun!nebbe From: nebbe@lglsun.epfl.ch (Robb Nebbe) Newsgroups: comp.lang.ada Subject: Re: Interfaces.C Date: 2 Nov 1994 13:34:17 GMT Organization: Ecole Polytechnique Federale de Lausanne Sender: nebbe@lglsun3.epfl.ch (Robb Nebbe) Distribution: world Message-ID: <1994Nov2.142450@lglsun.epfl.ch> References: <395o3q$2j1@wynkyn.ecs.soton.ac.uk> NNTP-Posting-Host: lglsun3.epfl.ch Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Keywords: Ada9X Date: 1994-11-02T13:34:17+00:00 List-Id: 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