Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by hub.org (8.9.1/8.9.1) with ESMTP id BAA07613 for ; Thu, 17 Dec 1998 01:30:08 -0500 (EST) (envelope-from Inoue@tpf.co.jp) Received: from cadzone ([126.0.1.40]) by sd.tpf.co.jp (2.0 Build 2131 (Berkeley 8.8.4)/8.8.4) with SMTP id PAA11980; Thu, 17 Dec 1998 15:30:07 +0900 From: "Hiroshi Inoue" To: Cc: "Tom Lane" , "\"Hiroki Kataoka\"" , "Magnus Hagander" Subject: RE: [INTERFACES] The problem between libpq and libpgtcl for WIN32 Date: Thu, 17 Dec 1998 15:31:52 +0900 Message-ID: <000601be2986$ef18f7e0$2801007e@cadzone.tpf.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 In-reply-to: <199812170400.XAA24111@hub.org> Importance: Normal Hi all. Hiroki Kataoka wrote > Hello all. > > > -----Original Message----- > > From: owner-pgsql-interfaces@postgreSQL.org > > [mailto:owner-pgsql-interfaces@postgreSQL.org]On Behalf Of Hiroshi Inoue > > Subject: [INTERFACES] The problem between libpq and libpgtcl for WIN32 > > > > > > The treatment of pgresStatus[] in libpq must be changed ? > > > > In case of Windows,global data interface between dll's is > > different from UNIX. > > If fact,libpgtcl references global data pgresStatus[] in libpq > > and pg_result -status command does not work properly for > > Windows. > > > > I think it is preferable to use function interfaces than gobal > > data references. > > > > Any ideas ? > > I solved this problem by the change in the following. > > ======== cut here ======== > *** libpq-fe.h.dist Tue Oct 6 23:16:48 1998 > - --- libpq-fe.h Tue Dec 15 03:52:34 1998 > *************** > *** 50,56 **** > - --- 50,60 ---- > } ExecStatusType; > > /* String descriptions of the ExecStatusTypes */ > + #ifdef WIN32 > + __declspec(dllimport) const char * const pgresStatus[]; > + #else > extern const char * const pgresStatus[]; > + #endif > > /* PGconn encapsulates a connection to the backend. > * The contents of this struct are not supposed to be known to > applications. > *** libpqdll.def.dist Tue Oct 6 23:05:02 1998 > - --- libpqdll.def Tue Dec 15 03:52:44 1998 > *************** > *** 63,68 **** > lo_unlink @ 60 > lo_import @ 61 > lo_export @ 62 > ! pgresStatus @ 63 > PQmblen @ 64 > PQresultErrorMessage @ 65 > - --- 63,68 ---- > lo_unlink @ 60 > lo_import @ 61 > lo_export @ 62 > ! pgresStatus @ 63 DATA > PQmblen @ 64 > PQresultErrorMessage @ 65 > ======== cut here ======== > > "pg_result -status" operates correctly by this method. Moreover, it is > thought that this method is easy because the change part is in libpq. > The word _declspec(dllimport) is Microsoft-specific and other compilers can't handle this keyword ? Magnus, libpq for WIN32 is only for Microsoft Visual C++ ? (Seems makefiles win32.mak are for Microsoft Visual C++). For this problem,Tom Lane wrote > But it seems reasonable to add a corresponding function call, say > > const char * PQresStatus (ExecStatusType status); > > and change libpgtcl to use that instead. We could even deprecate I agree with him because I don't like global data references. But the way Hiroki proposed has a advantage that binaries(libpq,libpgtcl) are invariant except the dll's for WIN32. Thanks. Hiroshi Inoue Inoue@tpf.co.jp