Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlnet: EAFNOSUPPORT on Max OSX
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Andrieu <oandrieu@n...>
Subject: Re: [Caml-list] Serious bug in the OCaml FFI?
On 5/5/07, Joel Reymont <joelr1@gmail.com> wrote:
> I'm using 32-bit Mac OSX 10.4.9 Intel.
>
> I inserted a print-out into my version of socketpair.c [1] and ran my
> OCaml test script
>
>      #use "topfind";;
>      #require "unix";;
>      let x, y = Unix.socketpair Unix.PF_UNIX Unix.SOCK_STREAM 0;;
>      Unix.getpeername y;;
>
> which resulted in
>
>      unix_socketpair: domain = 1, type = 1, proto = 0
>      Exception: Unix.Unix_error (Unix.EAFNOSUPPORT, "", "").
>
> Back at the toplevel
>
>      # (Obj.magic Unix.PF_UNIX:int);;
>      - : int = 0
>
>      # (Obj.magic Unix.SOCK_STREAM:int);;
>      - : int = 0
>
> Now, how exactly does 0 become 1 here?

It doesn't, your printf prints the value of the C constants PF_UNIX
and SOCK_STREAM, which apparently is 1.

-- 
  Olivier