Mail Archives: cygwin/1998/04/10/16:17:29
Received: by hermes7.cst.cnes.fr (SMI-8.6/SMI-SVR4)
id TAA11167; Tue, 7 Apr 1998 19:01:45 +0200
Date: Tue, 7 Apr 1998 19:01:45 +0200
From: genesis AT hermes9 DOT cst DOT cnes DOT fr (Utilisateur genesis)
Message-Id: <199804071701 DOT TAA11167 AT hermes7 DOT cst DOT cnes DOT fr>
To: ian AT cygnus DOT com
Subject: Re: Pipe with TCL/TK
Cc: gnuwin32 AT cygnus DOT com
X-Sun-Charset: US-ASCII
Thanks for your explanation.
I looked at expect/exp_event.c source code and I found an implement of Tcl_CreateFileHandler for cygwin32. I'm very interested because all my problems comes with this Tcl function that is only implemented on Unix platform.
I try to link my application with libexpect521.a to get Tcl_CreateFileHandler function on Windows platform. No problem with the link, but when I execute my program, it fails on Tcl_CreateFileHandler.
Is it possible to use libexpect521.a Tcl_CreateFileHandler function, mix with Tcl8.0 standard functions libraries ?
When I call expect function with C programs, is it necessary to initialize expect (like TCL/TK with a call to tkMain or TclAppInit for example) ? I don't find this information with the FAQs.
Thanks for your help.
Jean-Luc CAMES
> From ian AT tweedledumb DOT cygnus DOT com Mon Apr 6 22:54:20 1998
> Date: Mon, 6 Apr 1998 16:57:41 -0400 (EDT)
> From: ian AT cygnus DOT com
> To: genesis AT hermes9 DOT cst DOT cnes DOT fr
> Cc: gnu-win32 AT cygnus DOT com
> Subject: Re: Pipe with TCL/TK
>
> In gnu-win32 genesis AT hermes9 DOT cst DOT cnes DOT fr (Utilisateur genesis) writes:
>
> >I use TCK/TK with GNUWIN32-B19. My application use Tcl functions libraries to send Tcl and Tk commands.
> >I use pipe to interprocess communication, and I want to detect when a pipe may be read.
> >For that I created pipe with "pipe" function, and started a function handler "action_pipe" (for execute a callback when pipe may be read).
>
> > int fid[2];
> > Tcl_Channel pipe_channel;
> >#ifdef _WIN32
> > HANDLE pipe_handle;
> >#else
> > int pipe_fd;
> >#endif
>
>
> > pipe (fid);
> >#ifdef _WIN32
> > pipe_fd = get_osfhandle(fid[0]);
> >#else
> > pipe_fd = fid[0];
> >#endif
> > pipe_channel = Tcl_MakeFileChannel ( pipe_fd TCL_READABLE );
> > Tcl_CreateChannelHandler ( pipe_channel, TCL_READABLE,
> > action_pipe, (ClientData) fid[0] );
>
> >I've the same source code for SUN Solaris 2.5 and Windows NT GNUWIN32-B19. I've TCL/TK 8.0 on both platforms. I use -D_WIN32 compilation option on Windows.
>
> >I've no problem on SUN platform, the handler "action_pipe" is activate when a pipe may be read.
> >On Windows platform my application block when the TCl/TK event loop is started.
>
>
> Windows pipes are really lame. There is no way to get them to send
> you a message when there is some data to read, so you have to set up a
> separate thread to sit around trying to read from them. That's the
> point behind all the code I added to tclWinPipe.c.
>
> The problem with what you are trying to do is that you are treating a
> pipe as a file, by calling Tcl_MakeFileChannel. That won't work. On
> Windows, pipes are not files.
>
> The code I added to tclWinPipe.c will only help if you create a Tcl
> pipe.
>
> What you should do is look at the expect program, at
> expect/exp_event.c, where I had to get a similar thing to work. Look
> particularly at make_pipe_channel and friends. That will show you how
> to make a pipe channel that will work on Windows. It's pretty hairy.
>
> Ian
>
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -