Re: What is the best way to define the Imported C function
- From: Stefan Lucks <lucks@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 26 Jan 2008 13:15:31 +0100
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 topragma inline (Parse_Display); -- *** this seems to make sense ***
type Screen_ID is private;
-- This either does the job or raises an exception
procedure Parse_Display ( [...] );
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! ------
.
- References:
- What is the best way to define the Imported C function
- From: qunying
- Re: What is the best way to define the Imported C function
- From: Dmitry A. Kazakov
- What is the best way to define the Imported C function
- Prev by Date: Re: What is the best way to define the Imported C function
- Next by Date: Re: What is the best way to define the Imported C function
- Previous by thread: Re: What is the best way to define the Imported C function
- Next by thread: Re: What is the best way to define the Imported C function
- Index(es):
Relevant Pages
|