[Haskell-cafe] Libevent FFI problems

Adam Langley agl at imperialviolet.org
Fri Jul 25 13:21:40 EDT 2008

2008/7/23 Levi Greenspan <greenspan.levi at googlemail.com>:
> I would be grateful for any advices, hints or comments. And I really
> look forward to the FFI section in the "Real World Haskell" book.

Generally it looks pretty good. I think I'm missing some C code
(function "wrapper"). However, libevent is an odd choice to wrap. The
RTS already multiplexes IO for Haskell programs. In order not to block
the RTS, the libevent using code would have to be in its own kernel

Really, the RTS needs to be ported to libevent rather than an FFI wrapping.

For your specific problem, I see you're allocating xptr, but I don't
see that you're ever poking a value into it. Indeed, I can't see that
createEvent ever uses 'x'.

Hope that helps.


Adam Langley agl at imperialviolet.org http://www.imperialviolet.org

More information about the Haskell-Cafe mailing list