pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
The problem between libpq and libpgtcl for WIN32
5+ messages / 3 participants
[nested] [flat]

* The problem between libpq and libpgtcl for WIN32
@ 1998-12-14 10:12 Hiroshi Inoue <Inoue@tpf.co.jp>
  1998-12-15 01:25 ` Re: [INTERFACES] The problem between libpq and libpgtcl for WIN32 Tom Lane <tgl@sss.pgh.pa.us>
  1998-12-16 12:27 ` RE: [INTERFACES] The problem between libpq and libpgtcl for WIN32 Hiroki Kataoka <kataoka@interwiz.koganei.tokyo.jp>
  0 siblings, 2 replies; 5+ messages in thread

From: Hiroshi Inoue @ 1998-12-14 10:12 UTC (permalink / raw)
  To: pgsql-interfaces; pgsql-hackers <pgsql-hackers@postgreSQL.org>; +Cc: Magnus Hagander <mha@edu.sollentuna.se>; Tom Lane <tgl@sss.pgh.pa.us>

Hi all.
I have changed the subject from "libpq and libpgtcl in Windows".

My main point is

  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 ?

Thanks

Hiroshi Inoue
Inoue@tpf.co.jp

PS.
  I accepted a lot of mails about libpq and libpgtcl.
  Seems many people thought I am good at libpq,Tcl etc. 
  But my work is only the compilation of libpq and libpgtcl.

  LIBPQ for WIN32 is the work of Magnus Hagander.

  I changed libpgtcl and libpq just a little for pgaccess. 

  The dll's I provieded are only for pgaccess not for general use.



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [INTERFACES] The problem between libpq and libpgtcl for WIN32
  1998-12-14 10:12 The problem between libpq and libpgtcl for WIN32 Hiroshi Inoue <Inoue@tpf.co.jp>
@ 1998-12-15 01:25 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 5+ messages in thread

From: Tom Lane @ 1998-12-15 01:25 UTC (permalink / raw)
  To: Hiroshi Inoue <Inoue@tpf.co.jp>; +Cc: pgsql-interfaces

"Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
>   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 don't think we can really take pgresStatus[] out of libpq's API,
since that would break existing applications for no good reason.

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
use of the global array with an eye to removing it someday ...
not very soon though.

Anyone have an objection, or a different opinion about what the function
should be named?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* RE: [INTERFACES] The problem between libpq and libpgtcl for WIN32
  1998-12-14 10:12 The problem between libpq and libpgtcl for WIN32 Hiroshi Inoue <Inoue@tpf.co.jp>
@ 1998-12-16 12:27 ` Hiroki Kataoka <kataoka@interwiz.koganei.tokyo.jp>
  1 sibling, 0 replies; 5+ messages in thread

From: Hiroki Kataoka @ 1998-12-16 12:27 UTC (permalink / raw)
  To: pgsql-interfaces

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 ========
inline patch 1: libpq-fe.h Tue Dec 15 03:52:34 1998 (+4/-0 lines) download inline-1.patch*** 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.
inline patch 2: libpqdll.def Tue Dec 15 03:52:44 1998 (+1/-1 lines) download inline-2.patch*** 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. -- Hiroki Kataoka kataoka@interwiz.koganei.tokyo.jp Patches: download all (2 files, .tar.gz) ^ permalink raw reply [nested|flat] 5+ messages in thread

* RE: [INTERFACES] The problem between libpq and libpgtcl for WIN32
@ 1998-12-17 06:31 Hiroshi Inoue <Inoue@tpf.co.jp>
  1998-12-21 14:44 ` RE: [INTERFACES] The problem between libpq and libpgtcl for WIN32 Hiroki Kataoka <kataoka@interwiz.koganei.tokyo.jp>
  0 siblings, 1 reply; 5+ messages in thread

From: Hiroshi Inoue @ 1998-12-17 06:31 UTC (permalink / raw)
  To: pgsql-interfaces@hub.org; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; \"Hiroki Kataoka\" <kataoka@interwiz.koganei.tokyo.jp>; Magnus Hagander <mha@edu.sollentuna.se>

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





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* RE: [INTERFACES] The problem between libpq and libpgtcl for WIN32
  1998-12-17 06:31 RE: [INTERFACES] The problem between libpq and libpgtcl for WIN32 Hiroshi Inoue <Inoue@tpf.co.jp>
@ 1998-12-21 14:44 ` Hiroki Kataoka <kataoka@interwiz.koganei.tokyo.jp>
  0 siblings, 0 replies; 5+ messages in thread

From: Hiroki Kataoka @ 1998-12-21 14:44 UTC (permalink / raw)
  To: pgsql-interfaces

Hello all.

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
>
> Hi all.
>
	::
>
>  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++).

  I think that the source code assumes Microsoft Visual C++ is used at the
compilation time of libpq. But it is general at using libpq from another
application.

>  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.

  I agree with the addition of PQresStatus API.

>  But the way Hiroki proposed has a advantage that binaries(libpq,libpgtcl)
>  are invariant except the dll's for WIN32.

  I prepared another different method though looked like.  But, I think that
this method does not depend on MS VC++.  I want someone to try in the
environments other than MS VC++.

======== cut here ========
inline patch 1: libpq-fe.h Mon Dec 21 22:42:58 1998 (+5/-0 lines) download inline-1.patch*** libpq-fe.h.dist Tue Oct 6 23:16:48 1998 --- libpq-fe.h Mon Dec 21 22:42:58 1998 *************** *** 50,56 **** --- 50,61 ---- } ExecStatusType; /* String descriptions of the ExecStatusTypes */ + #ifdef WIN32 + extern const char * const (* _imp_pgresStatus)[]; + #define pgresStatus (* _imp_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.
inline patch 2: libpqdll.def Mon Dec 21 22:38:06 1998 (+1/-1 lines) download inline-2.patch*** libpqdll.def.dist Tue Oct 6 23:05:02 1998 --- libpqdll.def Mon Dec 21 22:38:06 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 ========
I do not think that my idea is final. However, I think that we can port the code of UNIX easily to the environment of WIN32 in this method. Thank you. -- Hiroki Kataoka kataoka@interwiz.koganei.tokyo.jp Patches: download all (2 files, .tar.gz) ^ permalink raw reply [nested|flat] 5+ messages in thread


end of thread, other threads:[~1998-12-21 14:44 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-12-14 10:12 The problem between libpq and libpgtcl for WIN32 Hiroshi Inoue <Inoue@tpf.co.jp>
1998-12-15 01:25 ` Tom Lane <tgl@sss.pgh.pa.us>
1998-12-16 12:27 ` Hiroki Kataoka <kataoka@interwiz.koganei.tokyo.jp>
1998-12-17 06:31 RE: [INTERFACES] The problem between libpq and libpgtcl for WIN32 Hiroshi Inoue <Inoue@tpf.co.jp>
1998-12-21 14:44 ` Hiroki Kataoka <kataoka@interwiz.koganei.tokyo.jp>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox