Browse thread
Creating wrappers for C libraries
-
Erik de Castro Lopo
- Chris King
- Sébastien Hinderer
-
Jon Harrop
-
David Baelde
- Sébastien Hinderer
-
David Baelde
- Richard Jones
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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 |
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.