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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8ebde0e81efb7e79 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Importing a Unix function call Date: 1998/12/06 Message-ID: #1/1 X-Deja-AN: 419177985 Sender: matt@mheaney.ni.net References: <36683FA3.2512DECF@ndirect.co.uk> NNTP-Posting-Date: Sun, 06 Dec 1998 01:15:53 PDT Newsgroups: comp.lang.ada Date: 1998-12-06T00:00:00+00:00 List-Id: Steve Crowe writes: > GNAT AdA compiler running under Unix, the function being imported is a > Unix 'pipe'. >From my man page: int pipe(int filedes[2]); pipe creates a pair of file descriptors, pointing to a pipe inode, and places them in the array pointed to by filedes. filedes[0] is for reading, filedes[1] is for writing. 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); type File_Descriptor_Array_Access is access all File_Descriptor_Array; pragma Convention (C, File_Descriptor_Array_Access); function Pipe (Files : in File_Descriptor_Array_Access) return C.Int; pragma Import (C, Pipe); end UNIX; You'd use it like: declare Files : alised File_Descriptor_Array; Status : constant C.Int := Pipe (Files'Access); begin ... Is that what you had in mind?