comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com (Tom Moran)
Subject: Re: Multiple pragma Imports
Date: 1998/12/27
Date: 1998-12-27T00:00:00+00:00	[thread overview]
Message-ID: <3686918c.1630214@news.pacbell.net> (raw)
In-Reply-To: 1998Dec27.083157.1@eisner

A fairly common situation is that an Ada binding has separated two
distinct types, which are the same in C for some function.  Thus the
Ada binding might have types Server_Socket and Client_Socket, which
are opened and used with different parameters, but are closed by a C
function with a single parameter.  Then a naive thin binding might try
to have
  procedure Close(Client : in out Client_Socket);
  pragma import(C, Close, "SClose");
  procedure Close(Server : in out Server_Socket);
  pragma import(C, Close, "SClose");
As I understand Robert Dewar's message, this is in fact illegal Ada,
though it has been accepted by more than one compiler in the past.
Something like
  procedure Close(Client : in out Client_Socket);
  pragma import(C, Close, "SClose");
  procedure Close(Server : in out Server_Socket) is
  begin
     Close(Client_Socket(Server));  -- appropriate type conversion
  end Close;
 would be needed.




  reply	other threads:[~1998-12-27  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-26  0:00 Multiple pragma Imports dewar
1998-12-27  0:00 ` Jerry van Dijk
1998-12-27  0:00   ` Larry Kilgallen
1998-12-27  0:00     ` Tom Moran [this message]
1998-12-28  0:00       ` dewar
1998-12-27  0:00     ` Jerry van Dijk
1998-12-28  0:00       ` dewar
1998-12-28  0:00         ` Jerry van Dijk
1998-12-28  0:00   ` dewar
1998-12-28  0:00 ` Tom Moran
1999-01-06  0:00 ` Matthew Heaney
1999-01-07  0:00   ` dewar
1999-01-07  0:00   ` Robert I. Eachus
replies disabled

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