[plt-scheme] FFI - C file handles -> scheme ports
On Jan 14, Hans Oesterholt-Dijkema wrote:
> Eli Barzilay schreef:
> > On Jan 14, Hans Oesterholt-Dijkema wrote:
> >
> >> Eli Barzilay schreef:
> >>
> >>> On Jan 14, Hans Oesterholt-Dijkema wrote:
> >>>
> >>>
> >>>> Dear All,
> >>>>
> >>>> Is it possible to reuse, or encapsulate C file handles (actually
> >>>> sockets) in a scheme port, using the FFI?
> >>>>
> >>>>
> >>> I don't think so. MzScheme works on a lower level than FILE*. The
> >>> best way I can think of is to create a custom input or output port
> >>> that uses the C level for its IO.
> >>>
> >>>
> >> Wouldn't a call to "select" on the C level block mzscheme entirely?
> >>
> >
> > Yes, you'll need to avoid any blocking C calls.
>
> Isn't there something like
>
> ¤ Scheme_Object *scheme_make_fd_input_port(int |fd|, Scheme_Object *|name|,
> int |regfile|, int |win_textmode|)
>
> ?
>
> To use?
Yes you can use that -- but that requires a file descriptor. By "file
handles" I thought that you meant a FILE* pointer. (Or maybe you're
asking how to use that function from Scheme?)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!