comp.lang.ada
 help / color / mirror / Atom feed
From: Stefan Lucks <lucks@th.informatik.uni-mannheim.de>
Subject: Re: What is the best way to define the Imported C function
Date: Sat, 26 Jan 2008 13:15:31 +0100
Date: 2008-01-26T13:15:31+01:00	[thread overview]
Message-ID: <Pine.LNX.4.64.0801261308470.4872@th.informatik.uni-mannheim.de> (raw)
In-Reply-To: <1cnnz29951u11.ljx9qpdkiwy9.dlg@40tude.net>

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)
 		       <Stefan.Lucks at medien.uni-weimar.de>
------  I  love  the  taste  of  Cryptanalysis  in  the  morning!  ------





  reply	other threads:[~2008-01-26 12:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-26  5:05 What is the best way to define the Imported C function qunying
2008-01-26 10:15 ` Martin Krischik
2008-01-26 16:24   ` qunying
2008-01-26 10:56 ` Dmitry A. Kazakov
2008-01-26 12:15   ` Stefan Lucks [this message]
2008-01-27  1:31 ` Jeffrey R. Carter
2008-01-28 17:18   ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox