Haskell <-> C/C++ comunication (sockets/pipes?)
Wed, 26 Sep 2001 16:07:46 +0100
> Hi Jorge,
> This is exa from #kde :)
Hi again :)
> Using stdin/stdout with ASCII first would be certainly easier. All you have
> to do is to define some GUI commands. Then if you convert to some binary
> interface, you could again use either pipes or sockets.
Yes, I'll start with simple stdin/stdout first.
> I'd referred to this function on irc, but anyway. In posix category.
> createNamedPipe :: FilePath -> FileMode -> IO ()
Yeap, you did, and I thought it was so easy to remember that I didn't
Then I forgot and couldn't find it in the Posix "input and output" section,
so I wondered if you had actually told me about createPipe (it was in the
file and directories section)
> createNamedPipe fifo mode calls mkfifo to create a new named pipe, fifo,
> with permissions based on mode.
> And of course you could create that fifo externally with a shell script if
> you'd like and run stuff from there. I'd almost certainly make it run over
> stdin/stdout on second thought. You do the connection externally as Sengan
> says. Create the pipes. fork the program. connect the stdin/stdout of child
> to your pipes. I think he did it writing C code, but you could also do it
> using bash, right?
> #! /bin/sh
> mkfifo input
> mkfifo output
> app <input >output &
> guifrontend >input <output
mmm it is a nice idea too :)
anyway I don't know if using the same output for both, interactive shell and
gui, is the best option, I'll have to give it some more thought.
> Since you will be using KDE, you don't have to worry too much about
> Windows. Unless of course one day you want to port it. :) Then you might
> consider writing another such GUI using MFC with Visual C++. And make it an
> ActiveX component, get it signed by MS, etc, etc. Or, alternatively port a
> large portion of KDE to windows.
I think I'll stick to Linux and maybe other *nixes for now :)
Thanks for all the ideas,