From 4051bce27dea570b452e7181591319be45d9c917 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Wed, 11 Jul 2001 22:12:43 +0000
Subject: [PATCH] Libpq++ fixes for Win32 compile.

Christian Ullrich
---
 src/include/c.h                       | 10 ++++++++--
 src/include/config.h.win32            |  3 +++
 src/interfaces/libpq++/pgconnection.h |  4 ++--
 src/interfaces/libpq++/pgcursordb.h   |  4 ++--
 src/interfaces/libpq++/pgdatabase.h   |  4 ++--
 src/interfaces/libpq++/pglobject.h    |  4 ++--
 src/interfaces/libpq++/pgtransdb.h    |  4 ++--
 src/win32.mak                         |  2 ++
 8 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/src/include/c.h b/src/include/c.h
index 2b6a9e0d7f0..0457a4af5b7 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: c.h,v 1.96 2001/07/03 20:21:50 petere Exp $
+ * $Id: c.h,v 1.97 2001/07/11 22:12:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -615,7 +615,13 @@ typedef NameData *Name;
 #else							/* not BUILDING_DLL */
 #define DLLIMPORT __declspec (dllimport)
 #endif
-#else							/* not CYGWIN */
+#elif defined(WIN32) && defined(_MSC_VER)	/* not CYGWIN */
+#if defined(_DLL)
+#define DLLIMPORT __declspec (dllexport)
+#else							/* not _DLL */
+#define DLLIMPORT __declspec (dllimport)
+#endif
+#else							/* not CYGWIN, not MSVC */
 #define DLLIMPORT
 #endif
 
diff --git a/src/include/config.h.win32 b/src/include/config.h.win32
index de46dbf6cfc..e8323b77364 100644
--- a/src/include/config.h.win32
+++ b/src/include/config.h.win32
@@ -20,3 +20,6 @@
 
 #define HAVE_ATEXIT
 #define HAVE_MEMMOVE
+
+#define HAVE_CXX_STRING_HEADER
+#define HAVE_NAMESPACE_STD
diff --git a/src/interfaces/libpq++/pgconnection.h b/src/interfaces/libpq++/pgconnection.h
index 76cb6ec3670..379f8d023e7 100644
--- a/src/interfaces/libpq++/pgconnection.h
+++ b/src/interfaces/libpq++/pgconnection.h
@@ -13,7 +13,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  * 
- * $Id: pgconnection.h,v 1.11 2001/05/09 17:29:10 momjian Exp $
+ * $Id: pgconnection.h,v 1.12 2001/07/11 22:12:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -57,7 +57,7 @@ extern "C" {
 // This class contains all the information about the connection
 // to the backend process.  All the database classes should be
 // derived from this class to obtain the connection interface.
-class PgConnection {
+class DLLIMPORT PgConnection {
 protected:
   PGconn* pgConn;			// Connection Structure
   PGresult* pgResult;			// Current Query Result
diff --git a/src/interfaces/libpq++/pgcursordb.h b/src/interfaces/libpq++/pgcursordb.h
index bbf8757ce4d..07a148f1dcb 100644
--- a/src/interfaces/libpq++/pgcursordb.h
+++ b/src/interfaces/libpq++/pgcursordb.h
@@ -14,7 +14,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- *  $Id: pgcursordb.h,v 1.7 2001/05/09 17:29:10 momjian Exp $
+ *  $Id: pgcursordb.h,v 1.8 2001/07/11 22:12:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,7 +42,7 @@
 // manipulates data through it.  The interface will introduce some
 // ease of use through the methods that will allow cursor specific
 // operations, like fetch, forward, etc.
-class PgCursor : public PgTransaction {
+class DLLIMPORT PgCursor : public PgTransaction {
 public:
   PgCursor(const char* conninfo, const char* cursor);	// use reasonable & environment defaults
   // connect to the database with given environment and database name
diff --git a/src/interfaces/libpq++/pgdatabase.h b/src/interfaces/libpq++/pgdatabase.h
index 2c502bd7847..5b2b8f40b73 100644
--- a/src/interfaces/libpq++/pgdatabase.h
+++ b/src/interfaces/libpq++/pgdatabase.h
@@ -14,7 +14,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- *  $Id: pgdatabase.h,v 1.11 2001/05/09 17:46:11 momjian Exp $
+ *  $Id: pgdatabase.h,v 1.12 2001/07/11 22:12:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@
 // This is the basic database access class.  Its interface should 
 // be used only after a query has been sent to the backend and
 // results are being received.
-class PgDatabase : public PgConnection {
+class DLLIMPORT PgDatabase : public PgConnection {
 public:
   // connect to the database with conninfo
   explicit PgDatabase(const char* conninfo) : PgConnection(conninfo) {}
diff --git a/src/interfaces/libpq++/pglobject.h b/src/interfaces/libpq++/pglobject.h
index 493182e97b7..0f094d26761 100644
--- a/src/interfaces/libpq++/pglobject.h
+++ b/src/interfaces/libpq++/pglobject.h
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- *  $Id: pglobject.h,v 1.7 2001/05/09 17:29:10 momjian Exp $
+ *  $Id: pglobject.h,v 1.8 2001/07/11 22:12:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,7 +35,7 @@
 // PgLargeObject - a class for accessing Large Object in a database
 //
 // ****************************************************************
-class PgLargeObject : public PgConnection {
+class DLLIMPORT PgLargeObject : public PgConnection {
 private:
   int pgFd;
   Oid pgObject;
diff --git a/src/interfaces/libpq++/pgtransdb.h b/src/interfaces/libpq++/pgtransdb.h
index b0f645fd02a..f322fa9a6d9 100644
--- a/src/interfaces/libpq++/pgtransdb.h
+++ b/src/interfaces/libpq++/pgtransdb.h
@@ -14,7 +14,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- *  $Id: pgtransdb.h,v 1.7 2001/05/09 17:29:10 momjian Exp $
+ *  $Id: pgtransdb.h,v 1.8 2001/07/11 22:12:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@
 // This is the database access class that keeps an open
 // transaction block during its lifetime.  The block is ENDed when
 // the object is destroyed.
-class PgTransaction : public PgDatabase {
+class DLLIMPORT PgTransaction : public PgDatabase {
 public:
   explicit PgTransaction(const char* conninfo);	// use reasonable & environment defaults
   // connect to the database with given environment and database name
diff --git a/src/win32.mak b/src/win32.mak
index 86d9ee8216e..862b409d0bc 100644
--- a/src/win32.mak
+++ b/src/win32.mak
@@ -20,6 +20,8 @@ ALL:
    cd ..
    cd interfaces\libpq
    nmake /f win32.mak $(MAKEMACRO)
+   cd ..\libpq++
+   nmake /f win32.mak $(MAKEMACRO)
    cd ..\..\bin\psql
    nmake /f win32.mak $(MAKEMACRO)
    cd ..\..
-- 
GitLab