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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f23882dec7858ff X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.germany.com!news.belwue.de!th!lucks From: Stefan Lucks Newsgroups: comp.lang.ada Subject: Re: What is the best way to define the Imported C function Date: Sat, 26 Jan 2008 13:15:31 +0100 Organization: InterNetNews at News.BelWue.DE (Stuttgart, Germany) Message-ID: References: <5db8e5dd-9632-4aef-b1e3-8cc304bcd748@u10g2000prn.googlegroups.com> <1cnnz29951u11.ljx9qpdkiwy9.dlg@40tude.net> NNTP-Posting-Host: th.informatik.uni-mannheim.de Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: news.belwue.de 1201349734 27026 134.155.91.85 (26 Jan 2008 12:15:33 GMT) X-Complaints-To: news@news.belwue.de NNTP-Posting-Date: Sat, 26 Jan 2008 12:15:33 +0000 (UTC) In-Reply-To: <1cnnz29951u11.ljx9qpdkiwy9.dlg@40tude.net> Xref: g2news1.google.com comp.lang.ada:19605 Date: 2008-01-26T13:15:31+01:00 List-Id: On Sat, 26 Jan 2008, Dmitry A. Kazakov wrote: > Surely, you would like to make a wrapper around the mess to make it more > Ada-friendly: Such a wrapper looks like a typical "please inline me" function: > type Display_ID is private; -- An opaque handle to > type Screen_ID is private; > -- This either does the job or raises an exception > procedure Parse_Display ( [...] ); pragma inline (Parse_Display); -- *** this seems to make sense *** > private > ... > procedure Parse_Display ( [...] ) is > function Internal ( [...] ) return Interfaces.C.int; > pragma Import (C, Internal, "xcb_parse_display"); [...] > Result : Interfaces.C.int := Internal ( [...] ); > begin > if Result = 0 then [...] > else > raise [...]; > end if; > end Parse_Display; -- Stefan Lucks (moved to Bauhaus-University Weimar, Germany) ------ I love the taste of Cryptanalysis in the morning! ------