caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: Vsevolod Fedorov <sevaAtWork@mail.ru>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Unix module API: nonblocking connect's errors retrieving
Date: Thu, 22 Sep 2005 10:14:49 -0400	[thread overview]
Message-ID: <f8560b8050922071439e6a211@mail.gmail.com> (raw)
In-Reply-To: <00de01c5bf7c$b9113610$670aa8c0@seva>

On 9/22/05, Vsevolod Fedorov <sevaAtWork@mail.ru> wrote:
> The problem is: 'getsockopt_int' returns 'int' while I need Unix.error type.
> I can't map int to error in good way.

I have also run into this same problem a while ago.

> May be is it the time to extend Unix module API?
> For example, add function like 'getsockopt_error' or 'int_to_error'?

There is already a C-function for handling that case in the
OCaml-runtime (unix_error).  You only need to write a C-wrapper that
converts the arguments to this function appropriately, and define an
"external"-function in OCaml.  Then you can raise the corresponding
Unix_error-exceptions by passing the error code and other arguments
(i.e. name of associated Unix-call and arguments).

But I agree, it would be a very good idea to expose this function in
the standard Unix-module (hint, hint!)...

Best regards,
Markus

--
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


  reply	other threads:[~2005-09-22 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-22 13:51 Vsevolod Fedorov
2005-09-22 14:14 ` Markus Mottl [this message]
2005-09-27 16:02 ` [Caml-list] " Jerome Vouillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f8560b8050922071439e6a211@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=sevaAtWork@mail.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).