Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by hub.org (8.9.3/8.9.3) with ESMTP id AAA71513 for ; Mon, 6 Sep 1999 00:35:16 -0400 (EDT) (envelope-from Inoue@tpf.co.jp) Received: from cadzone ([126.0.1.40] (may be forged)) by sd.tpf.co.jp (2.5 Build 2640 (Berkeley 8.8.6)/8.8.4) with SMTP id NAA06100; Mon, 06 Sep 1999 13:33:52 +0900 From: "Hiroshi Inoue" To: "Tom Lane" , "Magnus Hagander" Cc: "'David Giffin'" , "Ken J. Wright" , Subject: RE: [INTERFACES] Win32 interface Date: Mon, 6 Sep 1999 13:37:08 +0900 Message-ID: <000201bef821$7a95cf00$2801007e@cadzone.tpf.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 In-Reply-To: <24150.936458459@sss.pgh.pa.us> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Importance: Normal > -----Original Message----- > From: owner-pgsql-interfaces@postgreSQL.org > [mailto:owner-pgsql-interfaces@postgreSQL.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@postgreSQL.org > Subject: Re: [INTERFACES] Win32 interface > > > Magnus Hagander 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@tpf.co.jp