comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@ada.eu.org>
To: Nasser
Subject: Re: Ada 95 Sockets example wanted
Date: 1997/08/21
Date: 1997-08-21T00:00:00+00:00	[thread overview]
Message-ID: <qw6sow3onjt.fsf@esmeralda.enst.fr> (raw)
In-Reply-To: 5tdvo7$3ff@drn.zippo.com


>>>>> "Nasser" == Nasser  <Nasser> writes:

Nasser> One thing I noticed just browsing the GLADE code is that when
Nasser> a socket-related operation failes, a generic
Nasser> Communication_Error exception is raised.

Nasser> In C, one normally reads the value of the global error number,
Nasser> to tell specifically what the erorr was on the last call.

Yup, because there is no interest in getting the exact error when the
DSA's semantics tells we have to raise System.RPC.Communication_Error
in this case.

GLADE's socket packages are not intended for standalone use, but you
can freely adapt them (if you don't infringe the modified GPL) to get
errno.

Nasser> My question is then, how would the client know the exact error
Nasser> number, i.e. the reason why the call failed if one just raises
Nasser> a generic exception?  or a more general question, can one from
Nasser> gnat get hold of the errno set by calls into C library such as
Nasser> the socket examples above?

You can either import "errno" as an external Interfaces.C.int symbol,
or use the undocumented (and not guaranteed to be present in later
GNAT releases) function "__get_errno" from libgnat.a (you have to
import it also, it takes no argument and returns an
Interfaces.C.int). The latter has the advantage of being thread-safe.

  Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




  parent reply	other threads:[~1997-08-21  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-08-14  0:00 Ada 95 Sockets example wanted Marc A. Criley
1997-08-17  0:00 ` Robert Dewar
1997-08-19  0:00   ` Nasser
1997-08-20  0:00     ` Robert Dewar
1997-08-21  0:00     ` Samuel Tardieu [this message]
1997-08-18  0:00 ` Corey Minyard
replies disabled

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