I posted this question on the gtk-win32 list but it no longer seems to be
providing general support for gtk-win32.
Basically, I'm trying to use the function g_io_channel_win32_new_fd() with a
view (eventually) of using it for pipe io with Win32. The function seems
always to return a NULL pointer. I came across this archive post which
suggested a possible explanation:-
http://mail.gnome.org/archives/gtk-list/2009-August/msg00039.html
Tor's explanation was that glib is built using MSVC++6 whose file handles
won't work with anything later, such as VC++8 or 9. As it happens, I was
using using 8.
Armed with this information I wrote a simple test case (below) to try my
code with VC++6.
#include <io.h>
#include <fcntl.h>
#include <glib/giochannel.h>
int hPipes[2];
enum {READ, WRITE};
void SomeFunc()
{
int result = errno;
result = _pipe (hPipes, 4096, O_BINARY);
// 'hPipes[READ]' becomes '3' after the above call (stdin,
// stdout and stderr are presumably 0, 1 and 2)
GIOChannel* pChan = g_io_channel_win32_new_fd (hPipes[READ]);
// returns NULL
result = errno;
/* Note that 'result' equals zero throughout all the above calls */
close (hPipes[READ]);
close (hPipes[WRITE]);
}
The above code still returns a NULL pointer for 'pChan' irrespective of
whether I build it using VC++8 or VC++6. Have I missed a stage out
somewhere?? For example, is there some kind of 'init()' function that
I should have called? The main app does call gtk_init() but I'm not aware
of any more specific init() function that I might need.
John
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list