libpq++/pgconnection.h must not include postgres_fe.h, else it fails to
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 22 Jan 2002 19:02:40 +0000 (19:02 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 22 Jan 2002 19:02:40 +0000 (19:02 +0000)
compile in client apps that use the standard installed header set.
To allow removing that include, move DLLIMPORT definitions out of c.h
and into the appropriate port-specific header files.

src/include/c.h
src/include/pg_config.h.in
src/include/pg_config.h.win32
src/include/port/win.h
src/include/port/win32.h
src/interfaces/libpq++/pgconnection.h

index 4b4e1ab8438ffd17aafc8ad08594325951f3af41..a7e6aac42591106ce4e18d1725bd90f76a4aef11 100644 (file)
@@ -620,27 +620,8 @@ typedef NameData *Name;
 /* These are for things that are one way on Unix and another on NT */
 #define NULL_DEV               "/dev/null"
 
-/* defines for dynamic linking on Win32 platform */
-#ifdef __CYGWIN__
-#if __GNUC__ && ! defined (__declspec)
-#error You need egcs 1.1 or newer for compiling!
-#endif
-#ifdef BUILDING_DLL
-#define DLLIMPORT __declspec (dllexport)
-#else                                                  /* not BUILDING_DLL */
-#define DLLIMPORT __declspec (dllimport)
-#endif
-#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
-
-/* Provide prototypes for routines not present in a particular machine's
+/*
+ * Provide prototypes for routines not present in a particular machine's
  * standard C library. It'd be better to put these in pg_config.h, but
  * in pg_config.h we haven't yet included anything that defines size_t...
  */
index 7f6ed6008a5a7afe4f4e8dd38d8e442463407ec2..f97c317aabf65c3516203b86797d21ef448b6de1 100644 (file)
@@ -720,10 +720,19 @@ extern int fdatasync(int fildes);
 
 #include "pg_config_os.h"
 
+/*
+ * Provide default definitions for things that port-specific pg_config_os.h
+ * files can set, but typically don't.
+ */
+
+#ifndef DLLIMPORT
+#define DLLIMPORT                              /* no special DLL markers on most ports */
+#endif
+
 /*
  * The following is used as the arg list for signal handlers.  Any ports
  * that take something other than an int argument should override this in
- * the port-specific pg_config_os.h file.  Note that variable names are required
+ * their pg_config_os.h file.  Note that variable names are required
  * because it is used in both the prototypes as well as the definitions.
  * Note also the long name.  We expect that this won't collide with
  * other names causing compiler warnings.
index 007fee40efe52f99e31ff208112e7554a5f64138..eb833f3f90ec400cb43661d64b06815b31cf44fe 100644 (file)
 /* use _snprintf instead of snprintf */
 #define        HAVE_SNPRINTF_DECL
 #define snprintf       _snprintf
+
+/* defines for dynamic linking on Win32 platform */
+#ifdef __CYGWIN__
+
+#if __GNUC__ && ! defined (__declspec)
+#error You need egcs 1.1 or newer for compiling!
+#endif
+
+#ifdef BUILDING_DLL
+#define DLLIMPORT __declspec (dllexport)
+#else                                                  /* not BUILDING_DLL */
+#define DLLIMPORT __declspec (dllimport)
+#endif
+
+#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
+
 #endif /* pg_config_h_win32__ */
index e22502d39fbeace62a45a05fd7fd8331b7500ab9..52725a1e1af6bd7c2e79eb2790f093ec4527cf8f 100644 (file)
@@ -15,5 +15,31 @@ typedef unsigned char slock_t;
  */
 #if CYGWIN_VERSION_DLL_MAJOR < 1001
 #undef HAVE_UNIX_SOCKETS
+#endif
+
+/* defines for dynamic linking on Win32 platform */
+#ifdef __CYGWIN__
+
+#if __GNUC__ && ! defined (__declspec)
+#error You need egcs 1.1 or newer for compiling!
+#endif
+
+#ifdef BUILDING_DLL
+#define DLLIMPORT __declspec (dllexport)
+#else                                                  /* not BUILDING_DLL */
+#define DLLIMPORT __declspec (dllimport)
+#endif
+
+#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
index c9bf62784be9ce399d98bc5f0f7ba57c18138893..b9ef739e9ce631ac4bc5ab46c89108c49822ce2e 100644 (file)
@@ -1,2 +1,29 @@
 #define USES_WINSOCK
 #define NOFILE           100
+
+/* defines for dynamic linking on Win32 platform */
+#ifdef __CYGWIN__
+
+#if __GNUC__ && ! defined (__declspec)
+#error You need egcs 1.1 or newer for compiling!
+#endif
+
+#ifdef BUILDING_DLL
+#define DLLIMPORT __declspec (dllexport)
+#else                                                  /* not BUILDING_DLL */
+#define DLLIMPORT __declspec (dllimport)
+#endif
+
+#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
index c7a4ae19e0f513af641ea8440ef92209cd846890..5ff3ebe8fa1e93eb3b4af0fc51e172cd6d601c01 100644 (file)
@@ -38,7 +38,6 @@ extern "C" {
 #endif
 
 extern "C" {
-#include "postgres_fe.h"
 #include "libpq-fe.h"
 }