[MLton] filedes = int (was: Stack size?)

Wesley W. Terpstra wesley@terpstra.ca
Tue, 12 Jul 2005 21:10:16 +0200


On Mon, Jul 11, 2005 at 05:04:00PM -0400, Matthew Fluet wrote:
> However, more complicated FFI scenarios, say using NLFFI, might require 
> building a C-struct with a file_desc component, at which point we would 
> like to have the C-rep of a file_desc in hand.  So, there would likely 
> still be a need for exposing the representation.

Damn.

Well, there I was happily poking my epoll driven code, when I noticed that
in a couple places I do need to know that the file descriptors are integers
before they go through the FFI.

OTOH, armed with your symbol tricks:

fun identity x = x
val () = _export "sneaky_hack": int -> int; identity
val coerce x = _import "sneaky_hack": Posix.IO.file_desc -> int;

*giggle*

-- 
Wesley W. Terpstra