[plt-scheme] FFI and ports

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed May 7 16:27:51 EDT 2003

At Wed, 07 May 2003 14:16:04 -0500, David Van Horn wrote:
> Is there a way of making this printf statement print to the
> current-output-port? More generally, suppose the c-lambda is wrapping a C
> function that makes several calls to printf.  Is there a way to make it play
> nicely with Scheme ports?

There's not a simple way.

Under Unix, you can probably create an OS-level pipe to get pipe_in and
pipe_out, dup2(pipe_in, 1), then pump pipe_out into a Scheme output
port. I'm not sure it will work, and it's certainly no fun.

Matthew



Posted on the users mailing list.