
On Tue, Nov 19, 2013 at 12:13 PM, Thiago Padilha
I still dont understand why ghci is not using the default thread to run the binding, but from now on I will be more alert when binding to libraries that uses threads.
-fno-default-sandbox ? (this changes in upcoming ghci, I believe)
Theres something else I also dont understood about FFI: When trying to debug the problem I've written many printf statements but none of them showed on the screen, but now that the example is working I've notice that all printed text appears once I exit ghci. Why is that happening?
Because C/C++ stdio buffers by default, as does Haskell's --- but they are independent buffers, so the state of the Haskell buffering mode is not relevant to C/C++ or vice versa and flushing in one does not affect the other. Evidently the C one is only getting flushed in an atexit() hook. (You may want to look at setvbuf().) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net