More on POpen for Windows

Graham Klyne gk at
Tue Feb 24 18:48:23 EST 2004

Further to problems reported in [1].

I've made a small step forward on this.  I'm nearly out of time for now, so 
this is a partial report.

I've created a pair of simple C programs:

+ EchoShiftLetters.c
Reads from standard input and writes to standard output, converting all 
letters to upper case

+ SpawnEchoShiftLetters.c
Uses spawnProc (the function at the heart of POpen) to run 
EchoShiftLetters, write some data to its standard output and read back from 
the standard output and standard error streams.  It displays the data read 
back.  This program works fine.

What this demonstrates is that the basic Win32 API calls are working as 
expected, and that the problems encountered previously are probably to do 
with the Haskell-to-C interface, or the Hugs library routines that create 
I/O streams from file descriptors.  My next step, when I get more time, is 
to try a simple Haskell program spawning the EchoShiftLetters program -- 
I'm expecting that to fail.

There's one other datum:  I attempted to build these test programs using 
the MinGW gcc tools, but got an undefined symbol error (I think it was 
WinMain) when building the SpawnEchoShiftLetters program.  So I reverted to 
using the old MS Developer Studio tools.  I think it was probably just a 
library missing from the build, but can't be sure of that.

The code for all this can be found at [2].




Graham Klyne
For email:

More information about the Libraries mailing list