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.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID,PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,8ebde0e81efb7e79 X-Google-Attributes: gid103376,public From: "David Botton" Subject: Re: Importing a Unix function call Date: 1998/12/06 Message-ID: <74e7t5$2deg$1@news.gate.net>#1/1 X-Deja-AN: 419315815 References: <36683FA3.2512DECF@ndirect.co.uk> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Organization: CyberGate, Inc. Newsgroups: comp.lang.ada Date: 1998-12-06T00:00:00+00:00 List-Id: Since in Ada non-scalar types are passed by reference (ie as pointers) to C functions you could get rid of the Access type and treat it just like C: For our case see RM95 B.3 (70) : � An Ada parameter of an array type with component 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. function Pipe (Files : in File_Descriptor_Array) return C.Int; pragma Import (C, Pipe); declare Files : File_Descriptor_Array; Status : constant C.Int := Pipe (Files); begin It drives me crazy that many bindings are not written with these rules in mind making them so much easier to use. David Botton Matthew Heaney wrote in message ... >Steve Crowe writes: > >>From my man page: > > int pipe(int filedes[2]); > >C doesn't have out parameters: only in parameters that point to the >return data. > >How about something like: > >with Interfaces.C; use Interfaces; >package UNIX is > > type File_Descriptor is new C.int; > > type File_Descriptor_Array is > array (Positive range 1 .. 2) of File_Descriptor; > > pragma Convention (C, File_Descriptor_Array); >