Haskell <-> C/C++ comunication (sockets/pipes?)
Wed, 26 Sep 2001 16:07:01 +0100
> Actually I used unnamed pipes to make it work in Windows, since I needed it
> to work both on Unix and Windows. You basically rename the stdin and stdout
> of the haskell application into pipes so that the host app can talk to the
> stdin of the haskell app, and listen to the stdout of the haskell app. A
Nice idea :)
So you called the haskell app from C using popen... right? ( I haven't worked
with this stuff for ages, and I never really liked it that much, by that time
that was just some stuff I had to do in C when I could be playing with my
haskell book :)
I'm thinking about doing the other way around. Calling the gui from the
haskell app renaming the stdin and stdout of the gui into pipes.
Seems to me like the function "runProcess" can do the trick.
That way I could do
And run the text based mode
$haskellapp --with gui
and the haskell app would call the GUI.
> tip: under Windows, don't use the "posix functions" Windows provides if you
> code your app in C/C++: you'll run out of file handles before you've
> finished renaming stdin/stdout. Instead use the Windows functions.
I'm not really into windows... :)
Anyway, thanks for the tip.