From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id D4068BC0B for ; Fri, 8 Dec 2006 12:09:02 +0100 (CET) Received: from mailironport.loria.fr (mailironport.loria.fr [152.81.144.100]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kB8B8xDj027009 for ; Fri, 8 Dec 2006 12:08:59 +0100 Received: from galois.loria.fr (HELO Galois) ([152.81.9.23]) by mailironport.loria.fr with ESMTP; 08 Dec 2006 12:08:59 +0100 X-IronPort-AV: i="4.09,513,1157320800"; d="scan'208"; a="5709707:sNHT15472737" Received: from evariste by Galois with local (Exim 4.63) (envelope-from ) id 1Gsdb4-0002Rx-9H; Fri, 08 Dec 2006 12:08:54 +0100 Date: Fri, 8 Dec 2006 12:08:54 +0100 From: =?iso-8859-1?Q?S=E9bastien?= Hinderer To: david.baelde@ens-lyon.org Cc: caml-list@yquem.inria.fr Subject: Re: Creating wrappers for C libraries Message-ID: <20061208110854.GA9375@galois> Mail-Followup-To: david.baelde@ens-lyon.org, caml-list@yquem.inria.fr References: <20061208155437.7ed85c4f.mle+ocaml@mega-nerd.com> <200612080708.35547.jon@ffconsultancy.com> <53c655920612080218t765e9614j5d16c3b397f6691c@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <53c655920612080218t765e9614j5d16c3b397f6691c@mail.gmail.com> X-Sarkowall: Nicolas Sarkozy, pour une France karsherisee, sans Pensee, sans Idees X-Miltered: at concorde with ID 457947CB.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 wrappers:01 caml's:01 errno:01 typing:01 exception:01 exceptions:01 int:01 int:01 caml:02 caml:02 descriptor:02 problem:05 specify:06 variable:06 Hi. > One problem with such automated tools is that they have no clue of > which C function takes time and which returns almost instantly. Thanks a lot for this remark. I'm also wondering how good automatic tools are for taking advantage of Caml's rich typing system and of Caml features like exceptions. An example will probably make my question more clear. How would an automatic tool bind the open(2) function that returns either a file descriptor (on success), or -1 to report failures, the precise reason for the failure being contained in the errno variable. Would it be possible to specify, with an automatic tool, that the returned valid is an int unless open returns -1, in which case an error should be reported through an exception ? Or would an automatic tool bind open to a function returning an int in any case, the task of testing the returned value having then to be performed by the programmer, but in Caml ? Sébastien.