RE: [INTERFACES] Win32 interface

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "'David Giffin'" <david(at)agent911(dot)com>, "Ken J(dot) Wright" <ken(at)ori-ind(dot)com>, <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: RE: [INTERFACES] Win32 interface
Date: 1999-09-06 04:37:08
Message-ID: 000201bef821$7a95cf00$2801007e@cadzone.tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


> -----Original Message-----
> From: owner-pgsql-interfaces(at)postgreSQL(dot)org
> [mailto:owner-pgsql-interfaces(at)postgreSQL(dot)org]On Behalf Of Tom Lane
> Sent: Sunday, September 05, 1999 12:21 AM
> To: Magnus Hagander
> Cc: 'David Giffin'; Ken J. Wright; pgsql-interfaces(at)postgreSQL(dot)org
> Subject: Re: [INTERFACES] Win32 interface
>
>
> Magnus Hagander <mha(at)sollentuna(dot)net> writes:
> > The problem is that in the DllMain() of the libpq.dll file,
> WSAStartup() is
> > called, and that is required before any winsock functions will work.
> > If you link statically, you have to manually run WSAStartup.
> >
> > This should probably be documented :-)
>
> Didn't we talk about having fe-connect.c call WSAStartup()
> (conditionally compiled of course) to avoid this problem?
>

Sorry,I forgot to take static link cases into account when I proposed
to call WSAStartup() in DllMain().

> ISTM there was some reason it wouldn't work, like maybe you can
> only call WSAStartup once per program, but I don't recall for sure.

We can call WSAStartup() more than once. However,there must be a
call to WSACleanup() for every successful call to WSAStartup()
made by a task. Only the final WSACleanup() for that task does the
actual cleanup.
.
The simplest way may be to call WSAStartup() while connecting and
to call WSACleanup() while finishing(including error cases).

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Christoph Steinbeck 1999-09-06 10:03:30 JDBC: What is 'String type' in Serialize()-constructor?
Previous Message Bradley Schatz 1999-09-05 11:24:39 Debugging of ODBC Dlls on win32 - how ?