Thread: libpgtcl and WinNT

libpgtcl and WinNT

From
Ludek Finstrle
Date:
Hello,
 I have compilation problem with libpgtcl from postgresql 7.1 on WinNT.
The problem was that Tcl/Tk under WinNT doesn't support Tcl_CreateFileHandler
and Tcl_DeleteFileHandler functions. Make I something wrong?
I disabling part of code with this and compile libpgtcl. I have
no problems with using libpgtcl and pgaccess but I'm not sure that
my solution is right.

Have someone experience with it?

Luf


Re: libpgtcl and WinNT

From
Tom Lane
Date:
Ludek Finstrle <xfinstrl@informatics.muni.cz> writes:
>   I have compilation problem with libpgtcl from postgresql 7.1 on WinNT.
> The problem was that Tcl/Tk under WinNT doesn't support Tcl_CreateFileHandler
> and Tcl_DeleteFileHandler functions.

Yup.  This is not new in 7.1, it's been like that since Tcl 8.0 came
out.

In their infinite(?) wisdom, the Tcl boys removed all cross-platform
support for waiting for socket input in Tcl 8.0.  Presently libpgtcl
depends on Tcl_CreateFileHandler which is a Unix-only API.  Feel free
to contribute code to implement a Windows-compatible solution (maybe
even a Mac-compatible-too solution, like we used to have pre-Tcl-8).
Or rattle the cage over in Tcl land till they get some sense knocked
back into them.  Or something.  But right now it's busted.
        regards, tom lane


Re: libpgtcl and WinNT

From
"Edward Grabczewski"
Date:
I've just had an interesting reply from Kevin Kenny re the broken library
which Tom Lane commented on recently. I'm not experienced enought in TK/TCL
API programming yet to understand the answer fully but could someone comment
on the possibility of parching up the libarary based on this comment?

------------------------------------------------------
Edward Grabczewski wrote:
> Does anyone know why TCL 8 stopped supporiting the Tcl_CreateFileHandler
and
> Tcl_DeleteFileHandler functions which were in Tcl 7? Unfortunately, the
> Windows version of the PostgreSQL Tcl library - pgtcl.lib - requires these
> two functions and it's not possible to compile these libraries any more.

The functions themselves were not portable to non-Unix platforms.  The
capability of establishing callbacks on a file is still available; the
functions are named Tcl_CreateChannelHandler and Tcl_DeleteChannelHandler.

In the usual case, old code that used Tcl_CreateFileHandler and
Tcl_DeleteFileHandler was waiting for I/O on a socket.  The way to port
this forward is to wrap a Tcl_Channel around the socket by calling
Tcl_MakeTcpClientChannel.  The function name is a bit of a misnomer, since
it works just fine for sockets that use other protocols.  You don't
need to use channel-based I/O; it's fine to do 'recvfrom', 'read',
'send', 'write', or whatever in the channel handler as long as you
don't mix it with Tcl_Read, etc.

Also, I've heard that libtclpq does somewhat better on modern Tcl releases.
There are pointers to it on   http://tcl.activestate.com/software/tclhttpd/technotes.html
and http://tcl.activestate.com:8002/resource/software/extensions/database/

but both of them are pointing to hosts that my DNS won't resolve at the
moment, probably because of electrical outages elsewhere on the Internet.

The links are:   http://field.medicine.adelaide.edu.au/~colin/libtclpq/
and ftp://coldstore.sourceforge.net/pub/coldstore/libtclpq-20010120.tgz

in case you have better luck than I.
--
73 de ke9tv/2, Kevin KENNY GE Corporate R&D, Niskayuna, New York, USA
------------------------------------------------------

--
Eddy Grabczewski
eddy@polonia.co.uk



"Tom Lane" <tgl@sss.pgh.pa.us> wrote in message
news:10073.988779464@sss.pgh.pa.us...
> Ludek Finstrle <xfinstrl@informatics.muni.cz> writes:
> >   I have compilation problem with libpgtcl from postgresql 7.1 on WinNT.
> > The problem was that Tcl/Tk under WinNT doesn't support
Tcl_CreateFileHandler
> > and Tcl_DeleteFileHandler functions.
>
> Yup.  This is not new in 7.1, it's been like that since Tcl 8.0 came
> out.
>
> In their infinite(?) wisdom, the Tcl boys removed all cross-platform
> support for waiting for socket input in Tcl 8.0.  Presently libpgtcl
> depends on Tcl_CreateFileHandler which is a Unix-only API.  Feel free
> to contribute code to implement a Windows-compatible solution (maybe
> even a Mac-compatible-too solution, like we used to have pre-Tcl-8).
> Or rattle the cage over in Tcl land till they get some sense knocked
> back into them.  Or something.  But right now it's busted.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html




Re: Re: libpgtcl and WinNT

From
Tom Lane
Date:
"Edward Grabczewski" <xye85@dial.pipex.com> writes:
> I've just had an interesting reply from Kevin Kenny re the broken library
> which Tom Lane commented on recently. I'm not experienced enought in TK/TCL
> API programming yet to understand the answer fully but could someone comment
> on the possibility of parching up the libarary based on this comment?

This sounds like there is a new cross-platform interface that could
substitute for the old Tcl 7.* approach.  It might be kinda painful to
support both new and old via conditional compilation (so that we don't
break support for Tcl 7.*), but in principle it could be done.  Does
anyone have time to work on libpgtcl?  If you can write C it shouldn't
be too hard to fix it.
        regards, tom lane