View Single Post
  #13 (permalink)  
Old 07-09-2009, 01:56 PM
Gerald W. Lester
Guest
 
Posts: n/a
Default Re: tcl file handles on Linux and Windows - advice requested

Roger O wrote:
> On Jul 8, 7:00 pm, "Gerald W. Lester" <Gerald.Les...@cox.net> wrote:
>
>> That is not supported and is not portable. Please use the Tcl C API calls
>> to translate from a Tcl file handle to a C file descriptor.

>
> I am fully aware that this is not supported (despite the method on
> Linux being described in the first Tcl book by Tcl's inventor - I did
> not originate it). Sometimes one must hack. I strive not to do so. But
> this is a case where I think I will continue trying to sort this out.


Tcl is consistent -- the value is an opaque handle to be used by Tcl's
internals. You need to use the API call to convert the opaque handle to a C
file descriptor or handle.

Please note, that at *any* release of Tcl -- even a x.y.z bug fix release --
the appearance of that opaque handle may change and your hacks into it will
cease to work. You really need to use the C API.

Suggestion: create a very tiny extension that exposes the
Tcl_GetChannelHandle and Tcl_GetOpenFile in a meaningful way to you.

--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Reply With Quote