Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Creating wrappers for C libraries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-12-08 (11:09)
From: Sébastien Hinderer <Sebastien.Hinderer@e...>
Subject: Re: Creating wrappers for C libraries

> 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 ?